From b54a8458d5029b3494165b7430e21b3ae34ecc0c Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 22 Jan 2021 05:32:15 +0100 Subject: Upgrade Rails and add StimulusJS support --- app/views/agents/_edit.html.erb | 6 ++++++ app/views/agents/_form.html.erb | 22 ++++++++++++++++++++++ app/views/agents/index.html.erb | 5 +++++ app/views/agents/new.html.erb | 2 ++ app/views/agents/show.html.erb | 3 +++ 5 files changed, 38 insertions(+) create mode 100644 app/views/agents/_edit.html.erb create mode 100644 app/views/agents/_form.html.erb create mode 100644 app/views/agents/index.html.erb create mode 100644 app/views/agents/new.html.erb create mode 100644 app/views/agents/show.html.erb (limited to 'app/views/agents') 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 @@ +

Edit <%= @agent.presence&.name || 'new agent' %>

+

Context: <%= current_agent %>

+ +<%= 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 @@ +
+ <%= tag.legend "Propriétés de l'Agent" %> + +
+
<%= f.label :name %>
+
<%= f.text_field :name, maxlength: 64, placeholder: 'incommon' %> +
hint: this must match a group name on talk.incommon.cc
+ +
<%= f.label :summary %>
+
<%= f.text_field :summary, maxlength: 136, placeholder: 'Default Agent' %>
+ +
<%= f.label :description %>
+
<%= 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/' %>
+
+
+ +

<%= f.submit 'Save' %>

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 @@ +
+

Agents

+ + <%= render partial: @agents %> +
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 @@ +
+ <%= render partial: @agent %> +
-- cgit v1.2.3