From 1062c6328f60bf9cacba20c07f5cd33e55c153ee Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 14 Nov 2024 11:12:36 +0000 Subject: Adds credits to resource and required asterisks on form --- app/helpers/application_helper.rb | 8 ++++++++ app/helpers/pdfresources_helper.rb | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 app/helpers/pdfresources_helper.rb (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..b1c2b1e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,10 @@ module ApplicationHelper + def required_label_tag(form, field, text = nil) + label_content = text || field.to_s.titleize + required = form.object.class.validators_on(field).any? { |v| v.is_a?(ActiveRecord::Validations::PresenceValidator) } + + form.label field, class: "font-bold" do + required ? "#{label_content} *".html_safe : label_content + end + end end diff --git a/app/helpers/pdfresources_helper.rb b/app/helpers/pdfresources_helper.rb deleted file mode 100644 index 1f400cc..0000000 --- a/app/helpers/pdfresources_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PdfresourcesHelper -end -- cgit v1.2.3