From eabc7f330b8eb28db7086a5fa4ca82c2714b18ad Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 27 Jan 2021 17:04:47 +0000 Subject: [PATCH] Converge redaction forms to use bootstrap --- app/views/redactions/edit.html.erb | 18 ++++-------------- app/views/redactions/new.html.erb | 18 ++++-------------- app/views/redactions/show.html.erb | 6 +++--- config/locales/en.yml | 5 +++-- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/app/views/redactions/edit.html.erb b/app/views/redactions/edit.html.erb index aff2af919..e9b5beaac 100644 --- a/app/views/redactions/edit.html.erb +++ b/app/views/redactions/edit.html.erb @@ -4,18 +4,8 @@

<%= t ".heading" %>

<% end %> -<%= form_for(@redaction, :html => { :class => "standard-form" }) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :title, t(".title") %>
- <%= f.text_field :title %> -

-

- <%= f.label :description, t(".description") %>
- <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %> -

-

- <%= f.submit %> -

+<%= bootstrap_form_for(@redaction) do |f| %> + <%= f.text_field :title %> + <%= f.richtext_field :description, :cols => 80, :rows => 20, :format => @redaction.description_format %> + <%= f.primary %> <% end %> diff --git a/app/views/redactions/new.html.erb b/app/views/redactions/new.html.erb index 02e729b35..64089b2b0 100644 --- a/app/views/redactions/new.html.erb +++ b/app/views/redactions/new.html.erb @@ -3,18 +3,8 @@

<%= t ".heading" %>

<% end %> -<%= form_for(@redaction, :html => { :class => "standard-form" }) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :title, t(".title") %>
- <%= f.text_field :title %> -

-

- <%= f.label :description, t(".description") %>
- <%= richtext_area :redaction, :description, :cols => 80, :rows => 20, :format => @redaction.description_format %> -

-

- <%= f.submit %> -

+<%= bootstrap_form_for(@redaction) do |f| %> + <%= f.text_field :title %> + <%= f.richtext_field :description, :cols => 80, :rows => 20, :format => @redaction.description_format %> + <%= f.primary %> <% end %> diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb index cf5116ede..22d17cd5d 100644 --- a/app/views/redactions/show.html.erb +++ b/app/views/redactions/show.html.erb @@ -13,12 +13,12 @@ <% if can?(:edit, Redaction) || can?(:destroy, Redaction) %> -
+
<% if can?(:edit, Redaction) %> - <%= button_to t(".edit"), edit_redaction_path(@redaction), :method => :get %> + <%= link_to t(".edit"), edit_redaction_path(@redaction), :class => "btn btn-outline-primary" %> <% end %> <% if can?(:destroy, Redaction) %> - <%= button_to t(".destroy"), @redaction, :method => "delete", :remote => true, :data => { :confirm => t(".confirm") } %> + <%= link_to t(".destroy"), @redaction, :method => "delete", :class => "btn btn-outline-danger", :remote => true, :data => { :confirm => t(".confirm") } %> <% end %>
<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ea24854c6..f2f5616a8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -116,6 +116,9 @@ en: title: "Subject" body: "Body" recipient: "Recipient" + redaction: + title: Title + description: Description report: category: Select a reason for your report details: Please provide some more details about the problem (required). @@ -2841,7 +2844,6 @@ en: centre_map: Centre map here redactions: edit: - description: "Description" heading: "Edit redaction" title: "Edit redaction" index: @@ -2849,7 +2851,6 @@ en: heading: "List of redactions" title: "List of redactions" new: - description: "Description" heading: "Enter information for new redaction" title: "Creating new redaction" show: -- 2.39.5