Module: ZadokHelper
- Defined in:
- app/helpers/zadok_helper.rb
Instance Method Summary collapse
Instance Method Details
#resource_url_for(action) ⇒ Object
4 5 6 |
# File 'app/helpers/zadok_helper.rb', line 4 def resource_url_for(action) url_for(controller: controller_name, action: action) end |
#sort_table_header(attr, model) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/zadok_helper.rb', line 8 def sort_table_header(attr, model) name = t("activerecord.attributes.#{model}.#{attr}") cell_contents = if current_sort == "#{attr} asc" [name, icon(:fas, "chevron-down", class: "float-right")] elsif current_sort == "#{attr} desc" [name, icon(:fas, "chevron-up", class: "float-right")] else [name] end content_tag(:th, class: "sortable", data: { href: sort_url(current_search, attr) }) do safe_join(cell_contents, " ") end end |