aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb8
-rw-r--r--app/helpers/pdfresources_helper.rb2
2 files changed, 8 insertions, 2 deletions
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} <span class='text-red-500'>*</span>".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