Module: TurboMaterial::DataTableHelper
- Defined in:
- app/helpers/turbo_material/data_table_helper.rb
Instance Method Summary collapse
- #aria_sort(key, default: false) ⇒ Object
- #material_data_table(kwargs = {}) ⇒ Object
- #material_data_table_header(kwargs = {}) ⇒ Object
- #material_data_table_row_checkbox(kwargs = {}) ⇒ Object
- #material_data_table_sortable_header(kwargs = {}) ⇒ Object
- #sort_arrow(aria_sort) ⇒ Object
- #sort_class(aria_sort) ⇒ Object
Instance Method Details
#aria_sort(key, default: false) ⇒ Object
19 20 21 22 23 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 19 def aria_sort(key, default: false) return 'none' unless (params[:order] == key) || (params[:order].blank? && default) (params[:reverse] == 'true') || (params[:reverse].blank? && default) ? 'descending' : 'ascending' end |
#material_data_table(kwargs = {}) ⇒ Object
3 4 5 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 3 def material_data_table(kwargs = {}) render 'components/data_table', **kwargs end |
#material_data_table_header(kwargs = {}) ⇒ Object
15 16 17 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 15 def material_data_table_header(kwargs = {}) render 'components/data_table/header', **kwargs end |
#material_data_table_row_checkbox(kwargs = {}) ⇒ Object
7 8 9 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 7 def material_data_table_row_checkbox(kwargs = {}) render 'components/data_table/row_checkbox', **kwargs end |
#material_data_table_sortable_header(kwargs = {}) ⇒ Object
11 12 13 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 11 def material_data_table_sortable_header(kwargs = {}) render 'components/data_table/sortable_header', **kwargs end |
#sort_arrow(aria_sort) ⇒ Object
25 26 27 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 25 def sort_arrow(aria_sort) aria_sort == 'descending' ? 'arrow_downward' : 'arrow_upward' end |
#sort_class(aria_sort) ⇒ Object
29 30 31 |
# File 'app/helpers/turbo_material/data_table_helper.rb', line 29 def sort_class(aria_sort) aria_sort == 'none' ? '' : ' mdc-data-table__header-cell--sorted' end |