aboutsummaryrefslogtreecommitdiff
path: root/app/views/agents
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2021-01-22 05:32:15 +0100
committerhellekin <hellekin@cepheide.org>2021-01-22 05:32:15 +0100
commitb54a8458d5029b3494165b7430e21b3ae34ecc0c (patch)
tree32ea6fc6b8774f672325fec52f0ffc97229a9568 /app/views/agents
parent1c1aead78192982e221179de6688b944e5b01bf6 (diff)
downloadincommon-map-b54a8458d5029b3494165b7430e21b3ae34ecc0c.tar.gz
Upgrade Rails and add StimulusJS support
Diffstat (limited to 'app/views/agents')
-rw-r--r--app/views/agents/_edit.html.erb6
-rw-r--r--app/views/agents/_form.html.erb22
-rw-r--r--app/views/agents/index.html.erb5
-rw-r--r--app/views/agents/new.html.erb2
-rw-r--r--app/views/agents/show.html.erb3
5 files changed, 38 insertions, 0 deletions
diff --git a/app/views/agents/_edit.html.erb b/app/views/agents/_edit.html.erb
new file mode 100644
index 0000000..72ce56d
--- /dev/null
+++ b/app/views/agents/_edit.html.erb
@@ -0,0 +1,6 @@
+<h3>Edit <%= @agent.presence&.name || 'new agent' %></h3>
+<h2>Context: <%= current_agent %></h2>
+
+<%= form_with model: @agent, url: controller.action_name == 'new' ? agents_path : agent_path(@agent) do |f| %>
+ <%= render partial: 'form', locals: { agent: @agent, f: f } %>
+<% end %>
diff --git a/app/views/agents/_form.html.erb b/app/views/agents/_form.html.erb
new file mode 100644
index 0000000..563e8ec
--- /dev/null
+++ b/app/views/agents/_form.html.erb
@@ -0,0 +1,22 @@
+<fieldset>
+ <%= tag.legend "Propriétés de l'Agent" %>
+
+ <dl>
+ <dt><%= f.label :name %></dt>
+ <dd><%= f.text_field :name, maxlength: 64, placeholder: 'incommon' %>
+ <br>hint: this must match a group name on talk.incommon.cc</dd>
+
+ <dt><%= f.label :summary %></dt>
+ <dd><%= f.text_field :summary, maxlength: 136, placeholder: 'Default Agent' %></dd>
+
+ <dt><%= f.label :description %></dt>
+ <dd><%= f.text_area :description, cols: 72, rows: 10, spellcheck: true,
+placeholder: '## IN COMMON Default Agent
+
+La description _peut_ comporter du [Markdown].
+
+[Markdown]: https://www.markdownguide.org/getting-started/' %></dd>
+ </dl>
+</fieldset>
+
+<p><%= f.submit 'Save' %></p>
diff --git a/app/views/agents/index.html.erb b/app/views/agents/index.html.erb
new file mode 100644
index 0000000..6cb9fb3
--- /dev/null
+++ b/app/views/agents/index.html.erb
@@ -0,0 +1,5 @@
+<article id="agents">
+ <h1>Agents</h1>
+
+ <%= render partial: @agents %>
+</article>
diff --git a/app/views/agents/new.html.erb b/app/views/agents/new.html.erb
new file mode 100644
index 0000000..3794662
--- /dev/null
+++ b/app/views/agents/new.html.erb
@@ -0,0 +1,2 @@
+<%= render partial: 'edit', locals: { agent: @agent } %>
+
diff --git a/app/views/agents/show.html.erb b/app/views/agents/show.html.erb
new file mode 100644
index 0000000..0652dc8
--- /dev/null
+++ b/app/views/agents/show.html.erb
@@ -0,0 +1,3 @@
+<article class="agent" id="agent-<%= @agent.to_param %>">
+ <%= render partial: @agent %>
+</article>