Module: Utilities::PageHelper
- Included in:
- BaseEditingHelper, SearchHelper
- Defined in:
- app/helpers/utilities/page_helper.rb
Instance Method Summary collapse
- #boolean_to_icon(valore) ⇒ Object
- #error_messages_for(obj, field) ⇒ Object
- #new_button(path, options = {}) ⇒ Object
- #title_mod_g(base_class) ⇒ Object
- #title_new_g(base_class) ⇒ Object
Instance Method Details
#boolean_to_icon(valore) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/helpers/utilities/page_helper.rb', line 28 def boolean_to_icon(valore) if valore icon("check-lg", class: "text-success") else icon("x-lg", class: "text-danger") end end |
#error_messages_for(obj, field) ⇒ Object
45 46 47 48 49 50 |
# File 'app/helpers/utilities/page_helper.rb', line 45 def (obj, field) if obj.errors.include?(field) msg = obj.errors.(field).join(",") content_tag(:div, icon("x-circle-fill", msg), class: "invalid-feedback") end end |
#new_button(path, options = {}) ⇒ Object
38 39 40 41 |
# File 'app/helpers/utilities/page_helper.rb', line 38 def (path, = {}) .merge!({class: 'btn btn-success btn-sm'}) link_to icon("plus-lg", I18n.t(:new)), path, end |
#title_mod_g(base_class) ⇒ Object
3 4 5 |
# File 'app/helpers/utilities/page_helper.rb', line 3 def title_mod_g(base_class) "#{t("edit")} #{base_class.model_name.human}" end |
#title_new_g(base_class) ⇒ Object
8 9 10 |
# File 'app/helpers/utilities/page_helper.rb', line 8 def title_new_g(base_class) "#{t("new")} #{base_class.model_name.human}" end |