Module: Lintity::ApplicationHelper
- Defined in:
- app/helpers/lintity/application_helper.rb
Instance Method Summary collapse
- #filters_select_options ⇒ Object
- #numeric_filter_tag(filter_field, field_info) ⇒ Object
-
#render_entity_list_header(caption, button_path) ⇒ Object
Renders a header with a caption and an optional “New” button.
- #render_entity_report_header(caption, button_path) ⇒ Object
Instance Method Details
#filters_select_options ⇒ Object
10 11 12 13 14 15 |
# File 'app/helpers/lintity/application_helper.rb', line 10 def ( [OpenStruct.new(id: 'eq', name: '='), OpenStruct.new(id: 'less', name: '<='), OpenStruct.new(id: 'more', name: '>=')], 'id', 'name' ) end |
#numeric_filter_tag(filter_field, field_info) ⇒ Object
5 6 7 8 |
# File 'app/helpers/lintity/application_helper.rb', line 5 def numeric_filter_tag(filter_field, field_info) "#{field_info[:name]}<i class=\"bi bi-funnel-fill #{'text-success' if filter_field == field_info[:field]}\"></i>".html_safe, class: 'btn btn-link', data: { 'entity-list-field-param' => field_info[:field], 'action' => 'click->entity-list#numberic_filter' } end |
#render_entity_list_header(caption, button_path) ⇒ Object
Renders a header with a caption and an optional “New” button. caption - String displayed as the header title. button_path - URL for the button; if nil or blank, the button is omitted.
20 21 22 23 24 25 |
# File 'app/helpers/lintity/application_helper.rb', line 20 def render_entity_list_header(caption, ) content_tag(:div, class: 'entity-list-header d-flex justify-content-between align-items-center mb-3') do concat content_tag(:h2, caption, class: 'mb-0') concat link_to('New', , class: 'btn btn-primary') if .present? end end |
#render_entity_report_header(caption, button_path) ⇒ Object
27 28 29 30 31 32 |
# File 'app/helpers/lintity/application_helper.rb', line 27 def render_entity_report_header(caption, ) content_tag(:div, class: 'entity-list-header d-flex justify-content-between align-items-center mb-3') do concat content_tag(:h2, caption, class: 'mb-0') concat link_to('PDF', , class: 'btn btn-primary') if .present? end end |