Module: Sal::ApplicationHelper
- Defined in:
- app/helpers/sal/application_helper.rb
Instance Method Summary collapse
- #errors_bar(*entities) ⇒ Object
- #menu_item(item, tag = :li) ⇒ Object
- #menu_items(set) ⇒ Object
- #messages_bar ⇒ Object
Instance Method Details
#errors_bar(*entities) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/sal/application_helper.rb', line 3 def (*entities) entities = Array(entities) = entities.map { |entity| entity.errors[:base].map &:capitalize }.flatten # is there any non-base error? if entities.detect { |entity| entity.errors.keys.detect { |error| error != :base } } << t(:errors_bar_message) end if .any? content_tag :div, .join("\n"), class: 'alert alert-danger' end end |
#menu_item(item, tag = :li) ⇒ Object
26 27 28 29 30 31 |
# File 'app/helpers/sal/application_helper.rb', line 26 def (item, tag = :li) = section == item ? {class: 'active'} : {} content_tag tag, do yield end end |
#menu_items(set) ⇒ Object
33 34 35 36 37 38 |
# File 'app/helpers/sal/application_helper.rb', line 33 def (set) @_set = set output = yield @_set = :menu output end |
#messages_bar ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/helpers/sal/application_helper.rb', line 18 def if notice content_tag :div, notice.html_safe, class: 'alert alert-success' elsif alert content_tag :div, alert.html_safe, class: 'alert alert-warning' end end |