From 8afaec9d01520c955a625fbc9cc9d8cddf23542d Mon Sep 17 00:00:00 2001 From: Ben Morrall Date: Fri, 20 Sep 2024 12:33:05 +0800 Subject: [PATCH] Add cancel and back span helpers --- app/helpers/application_helper.rb | 10 ++++++++++ app/views/animals/csv_upload.html.erb | 2 +- app/views/animals/edit.html.erb | 2 +- app/views/animals/new.html.erb | 2 +- app/views/animals/show.html.erb | 4 ++-- app/views/cohort_imports/new.html.erb | 2 +- app/views/cohorts/edit.html.erb | 2 +- app/views/cohorts/new.html.erb | 2 +- app/views/cohorts/show.html.erb | 4 ++-- app/views/enclosures/csv_upload.html.erb | 2 +- app/views/enclosures/edit.html.erb | 2 +- app/views/enclosures/new.html.erb | 2 +- app/views/enclosures/show.html.erb | 5 ++--- app/views/exit_types/edit.html.erb | 2 +- app/views/exit_types/new.html.erb | 2 +- app/views/exit_types/show.html.erb | 6 +++--- app/views/facilities/edit.html.erb | 2 +- app/views/facilities/new.html.erb | 2 +- app/views/facilities/show.html.erb | 2 +- app/views/locations/edit.html.erb | 2 +- app/views/locations/index.html.erb | 2 +- app/views/locations/new.html.erb | 2 +- app/views/locations/show.html.erb | 2 +- app/views/measurement_types/edit.html.erb | 2 +- app/views/measurement_types/new.html.erb | 2 +- app/views/measurement_types/show.html.erb | 2 +- app/views/measurements/edit.html.erb | 3 +-- app/views/measurements/show.html.erb | 4 ++-- app/views/passwords/edit.html.erb | 2 +- app/views/users/edit.html.erb | 2 +- app/views/users/new.html.erb | 2 +- app/views/users/show.html.erb | 2 +- 32 files changed, 47 insertions(+), 39 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ed6a048d..cda91e90 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,13 @@ module ApplicationHelper include Pagy::Frontend + + # << Back + def back_span_tag + content_tag(:span, "<< Back") + end + + # << Cancel + def cancel_span_tag + content_tag(:span, "<< Cancel") + end end diff --git a/app/views/animals/csv_upload.html.erb b/app/views/animals/csv_upload.html.erb index d428727e..13470de9 100644 --- a/app/views/animals/csv_upload.html.erb +++ b/app/views/animals/csv_upload.html.erb @@ -19,6 +19,6 @@ <% end %> - <%= link_to '<< Back', animals_path, class: 'button-outline-primary' %> + <%= link_to back_span_tag, animals_path, class: 'button-outline-primary' %> diff --git a/app/views/animals/edit.html.erb b/app/views/animals/edit.html.erb index d6903939..531dbe13 100644 --- a/app/views/animals/edit.html.erb +++ b/app/views/animals/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to animals_path do %> <% end %>

Editing Animal

diff --git a/app/views/animals/new.html.erb b/app/views/animals/new.html.erb index c7a34774..5c1a3d26 100644 --- a/app/views/animals/new.html.erb +++ b/app/views/animals/new.html.erb @@ -2,7 +2,7 @@
<%= link_to animals_path do %> <% end %>

New Animal

diff --git a/app/views/animals/show.html.erb b/app/views/animals/show.html.erb index 70b326a1..c56d98e5 100644 --- a/app/views/animals/show.html.erb +++ b/app/views/animals/show.html.erb @@ -4,7 +4,7 @@
<%= link_to animals_path do %> <% end %> <%= link_to edit_animal_path(@animal) do %> @@ -36,7 +36,7 @@
SHL Numbers
<%= @animal.shl_number_codes(", ") %>
- <%= link_to '<< BACK', animals_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, animals_path, class: "mr-3 mb-3 button-outline-primary" %> <%= link_to "Edit", edit_animal_path(@animal), class: "button-outline-primary mt-4" %>
diff --git a/app/views/cohort_imports/new.html.erb b/app/views/cohort_imports/new.html.erb index 4ff0b6b7..f9bc0f76 100644 --- a/app/views/cohort_imports/new.html.erb +++ b/app/views/cohort_imports/new.html.erb @@ -18,6 +18,6 @@ <% end %>
- <%= link_to '<< Back', cohorts_path, class: 'button-outline-primary' %> + <%= link_to back_span_tag, cohorts_path, class: 'button-outline-primary' %> diff --git a/app/views/cohorts/edit.html.erb b/app/views/cohorts/edit.html.erb index 62a46b18..aa3828bf 100644 --- a/app/views/cohorts/edit.html.erb +++ b/app/views/cohorts/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to cohorts_path do %> <% end %>

Editing Cohort

diff --git a/app/views/cohorts/new.html.erb b/app/views/cohorts/new.html.erb index facd9cc9..c469b49d 100644 --- a/app/views/cohorts/new.html.erb +++ b/app/views/cohorts/new.html.erb @@ -2,7 +2,7 @@
<%= link_to cohorts_path do %> <% end %>

New Cohort

diff --git a/app/views/cohorts/show.html.erb b/app/views/cohorts/show.html.erb index 4c502727..3da10139 100644 --- a/app/views/cohorts/show.html.erb +++ b/app/views/cohorts/show.html.erb @@ -4,7 +4,7 @@
<%= link_to cohorts_path do %> <% end %> <%= link_to edit_cohort_path(@cohort) do %> @@ -30,7 +30,7 @@ <%= link_to animal.tag, animal_path(animal) %> <% end %>
- <%= link_to '<< BACK', cohorts_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, cohorts_path, class: "mr-3 mb-3 button-outline-primary" %> <%= link_to "Edit", edit_cohort_path(@cohort), class: "button-outline-primary mt-4" %>
diff --git a/app/views/enclosures/csv_upload.html.erb b/app/views/enclosures/csv_upload.html.erb index 39856bdf..ba1ccdb5 100644 --- a/app/views/enclosures/csv_upload.html.erb +++ b/app/views/enclosures/csv_upload.html.erb @@ -22,6 +22,6 @@ <% end %>
- <%= link_to '<< Back', enclosures_path, class: 'button-outline-primary' %> + <%= link_to back_span_tag, enclosures_path, class: 'button-outline-primary' %> diff --git a/app/views/enclosures/edit.html.erb b/app/views/enclosures/edit.html.erb index 746bfbd9..f4745273 100644 --- a/app/views/enclosures/edit.html.erb +++ b/app/views/enclosures/edit.html.erb @@ -1,7 +1,7 @@
<%= link_to enclosures_path, class: "inline-flex items-center py-2 mb-4 font-bold rounded text-primary-dark hover:text-primary" do %> - << Cancel + <%= cancel_span_tag %> <% end %>

Editing Enclosure

diff --git a/app/views/enclosures/new.html.erb b/app/views/enclosures/new.html.erb index a7b45019..99f1d381 100644 --- a/app/views/enclosures/new.html.erb +++ b/app/views/enclosures/new.html.erb @@ -1,7 +1,7 @@
<%= link_to enclosures_path, class: "inline-flex items-center py-2 mb-4 font-bold rounded text-primary-dark hover:text-primary" do %> - << Cancel + <%= cancel_span_tag %> <% end %>

New Enclosure

diff --git a/app/views/enclosures/show.html.erb b/app/views/enclosures/show.html.erb index 1cc00765..6591ade4 100644 --- a/app/views/enclosures/show.html.erb +++ b/app/views/enclosures/show.html.erb @@ -3,7 +3,7 @@

<%= notice %>

<%= link_to enclosures_path, class: "inline-flex items-center py-2 font-bold rounded text-primary-dark hover:text-primary" do %> - << Back + <%= back_span_tag %> <% end %> <%= link_to edit_enclosure_path(@enclosure), class: "inline-flex items-center px-4 py-2 font-bold text-white rounded bg-primary-dark hover:bg-primary" do %> Edit Enclosure @@ -21,9 +21,8 @@ <%= @enclosure.location_name %>
- <%= link_to '<< BACK', enclosures_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, enclosures_path, class: "mr-3 mb-3 button-outline-primary" %> <%= link_to "Edit", edit_enclosure_path(@enclosure), class: "button-outline-primary mt-4" %>
- diff --git a/app/views/exit_types/edit.html.erb b/app/views/exit_types/edit.html.erb index c3342827..edc5eb21 100644 --- a/app/views/exit_types/edit.html.erb +++ b/app/views/exit_types/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to exit_types_path do %> <% end %>

Editing Exit Type

diff --git a/app/views/exit_types/new.html.erb b/app/views/exit_types/new.html.erb index 9879be06..e49bade5 100644 --- a/app/views/exit_types/new.html.erb +++ b/app/views/exit_types/new.html.erb @@ -2,7 +2,7 @@
<%= link_to exit_types_path do %> <% end %>

New Exit Type

diff --git a/app/views/exit_types/show.html.erb b/app/views/exit_types/show.html.erb index 8a294ac6..d59a8822 100644 --- a/app/views/exit_types/show.html.erb +++ b/app/views/exit_types/show.html.erb @@ -4,7 +4,7 @@
<%= link_to exit_types_path do %> <% end %> <%= link_to edit_exit_type_path(@exit_type) do %> @@ -22,7 +22,7 @@
Name
<%= @exit_type.name %>
- <%= link_to '<< BACK', exit_types_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, exit_types_path, class: "mr-3 mb-3 button-outline-primary" %> <%= link_to "Edit", edit_exit_type_path(@exit_type), class: "button-outline-primary mt-4" %>
-
\ No newline at end of file + diff --git a/app/views/facilities/edit.html.erb b/app/views/facilities/edit.html.erb index 44efc5bd..43588b83 100644 --- a/app/views/facilities/edit.html.erb +++ b/app/views/facilities/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to facilities_path do %> <% end %>

Editing Facility

diff --git a/app/views/facilities/new.html.erb b/app/views/facilities/new.html.erb index f3459fe3..4bd65f16 100644 --- a/app/views/facilities/new.html.erb +++ b/app/views/facilities/new.html.erb @@ -2,7 +2,7 @@
<%= link_to facilities_path do %> <% end %>

New Facility

diff --git a/app/views/facilities/show.html.erb b/app/views/facilities/show.html.erb index 37d61cc4..5e864471 100644 --- a/app/views/facilities/show.html.erb +++ b/app/views/facilities/show.html.erb @@ -4,7 +4,7 @@
<%= link_to facilities_path do %> <% end %> <%= link_to edit_facility_path(@facility) do %> diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb index c4522698..919fe603 100644 --- a/app/views/locations/edit.html.erb +++ b/app/views/locations/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to facility_locations_path do %> <% end %>

Editing Location

diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 8707cef4..6cad04ab 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -4,7 +4,7 @@
<%= link_to facilities_path do %> <% end %> <%= link_to new_facility_location_path(@facility) do %> diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index 496ebf1d..e8eff732 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -2,7 +2,7 @@
<%= link_to facility_locations_path(@facility) do %> <% end %>

New Location

diff --git a/app/views/locations/show.html.erb b/app/views/locations/show.html.erb index 62e1cd57..3dc9bbac 100644 --- a/app/views/locations/show.html.erb +++ b/app/views/locations/show.html.erb @@ -3,7 +3,7 @@
<%= link_to facility_locations_path(@facility) do %> <% end %> <%= link_to edit_facility_location_path(@facility, @location) do %> diff --git a/app/views/measurement_types/edit.html.erb b/app/views/measurement_types/edit.html.erb index 8404b3c6..0ecc018d 100644 --- a/app/views/measurement_types/edit.html.erb +++ b/app/views/measurement_types/edit.html.erb @@ -1,6 +1,6 @@
- <%= link_to '<< Back', measurement_types_path, class: 'text-primary-dark hover:text-primary font-bold py-2 rounded inline-flex items-center mb-4' %> + <%= link_to back_span_tag, measurement_types_path, class: 'text-primary-dark hover:text-primary font-bold py-2 rounded inline-flex items-center mb-4' %>

Editing Measurement Type

<%= render 'form', measurement_type: @measurement_type %> diff --git a/app/views/measurement_types/new.html.erb b/app/views/measurement_types/new.html.erb index d1552cc9..a876b3a6 100644 --- a/app/views/measurement_types/new.html.erb +++ b/app/views/measurement_types/new.html.erb @@ -4,6 +4,6 @@
<%= render 'form', measurement_type: @measurement_type %>
- <%= link_to '<< Back', measurement_types_path, class: 'text-primary-dark hover:text-primary font-bold py-2 rounded inline-flex items-center mb-4' %> + <%= link_to back_span_tag, measurement_types_path, class: 'text-primary-dark hover:text-primary font-bold py-2 rounded inline-flex items-center mb-4' %>
diff --git a/app/views/measurement_types/show.html.erb b/app/views/measurement_types/show.html.erb index fb28d2a2..d28e578f 100644 --- a/app/views/measurement_types/show.html.erb +++ b/app/views/measurement_types/show.html.erb @@ -4,7 +4,7 @@
<%= link_to measurement_types_path do %> <% end %> <%= link_to edit_measurement_type_path(@measurement_type) do %> diff --git a/app/views/measurements/edit.html.erb b/app/views/measurements/edit.html.erb index 0e28d99f..a685acc1 100644 --- a/app/views/measurements/edit.html.erb +++ b/app/views/measurements/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to measurements_path do %> <% end %>

Editing Measurement

@@ -11,4 +11,3 @@
- diff --git a/app/views/measurements/show.html.erb b/app/views/measurements/show.html.erb index ada5810f..94294bb5 100644 --- a/app/views/measurements/show.html.erb +++ b/app/views/measurements/show.html.erb @@ -4,7 +4,7 @@
<%= link_to measurements_path do %> <% end %>
@@ -27,6 +27,6 @@
<%= subject_name_value %>
- <%= link_to '<< BACK', measurements_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, measurements_path, class: "mr-3 mb-3 button-outline-primary" %>
diff --git a/app/views/passwords/edit.html.erb b/app/views/passwords/edit.html.erb index 784a06ce..92fc3770 100644 --- a/app/views/passwords/edit.html.erb +++ b/app/views/passwords/edit.html.erb @@ -27,6 +27,6 @@
<% end %>
- <%= link_to('<< Back', users_path, class: "button-outline-primary") if @user.admin? %> + <%= link_to(back_span_tag, users_path, class: "button-outline-primary") if @user.admin? %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 3bc80aea..4beb7b2a 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -2,7 +2,7 @@
<%= link_to users_path do %> <% end %>

Editing User

diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 458fd2d8..dc38be0a 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -2,7 +2,7 @@
<%= link_to users_path do %> <% end %>

New User

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 142df9e4..36b1fbdc 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -12,7 +12,7 @@ <%= @user.email %>
- <%= link_to '<< BACK', users_path, class: "mr-3 mb-3 button-outline-primary" %> + <%= link_to back_span_tag, users_path, class: "mr-3 mb-3 button-outline-primary" %> <%= link_to "Edit", edit_user_path(@user), class: "button-outline-primary mt-4" %>