Module: FuiHelper
- Defined in:
- app/helpers/fui_helper.rb
Overview
Provides the fui_javascript_tags helper for loading jQuery and Fomantic-UI component scripts in the correct order.
Usage (in your application layout, before javascript_importmap_tags):
<%= fui_javascript_tags %>
<%= javascript_importmap_tags %>
This emits
Renders a DataTables-powered table via Stimulus controller.
Generates a
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/helpers/fui_helper.rb', line 70 def datatable(columns: [], options: {}, &block) = .to_json content_tag(:div, data: { controller: "fui-datatable", "fui-datatable-options-value": } ) do content_tag(:table, class: "ui celled striped table", style: "width:100%") do thead = content_tag(:thead) do content_tag(:tr) do safe_join(columns.map { |col| content_tag(:th, col) }) end end tbody = content_tag(:tbody, &block) thead + tbody end end end |
#fui_javascript_tags ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/fui_helper.rb', line 45 def = [] << javascript_include_tag("jquery") FOMANTIC_SCRIPTS.each do |name| << javascript_include_tag(name) end << javascript_include_tag("datatables") safe_join(, "\n") end |