Module: CmAdmin::ViewHelpers
- Includes:
- ActionView::Helpers::FormTagHelper, ActionView::Helpers::TagHelper, ActionDropdownHelper, FieldDisplayHelper, FilterHelper, FormHelper, ManageColumnPopupHelper, NavigationHelper, PageInfoHelper
- Defined in:
- lib/cm_admin/view_helpers.rb,
lib/cm_admin/view_helpers/form_helper.rb,
lib/cm_admin/view_helpers/filter_helper.rb,
lib/cm_admin/view_helpers/page_info_helper.rb,
lib/cm_admin/view_helpers/form_field_helper.rb,
lib/cm_admin/view_helpers/navigation_helper.rb,
lib/cm_admin/view_helpers/field_display_helper.rb,
lib/cm_admin/view_helpers/action_dropdown_helper.rb,
lib/cm_admin/view_helpers/manage_column_popup_helper.rb
Defined Under Namespace
Modules: ActionDropdownHelper, FieldDisplayHelper, FilterHelper, FormFieldHelper, FormHelper, ManageColumnPopupHelper, NavigationHelper, PageInfoHelper
Constant Summary
Constants included
from FormHelper
FormHelper::REJECTABLE
Instance Method Summary
collapse
#action_description, #action_title, #custom_action_button, #custom_action_items, #custom_modal_button, #page_title, #page_url
#navigation_links
#manage_column_body, #manage_column_body_list, #manage_column_dragger, #manage_column_footer, #manage_column_header, #manage_column_item_name, #manage_column_item_pointer, #manage_column_pop_up
Methods included from FormHelper
#form_with_all_fields, #form_with_mentioned_fields, #generate_form, #set_form_for_fields
#input_field_for_column, #select_collection_value
#add_date_filter, #add_filters_dropdown, #add_multi_select_filter, #add_range_filter, #add_search_filter, #add_single_select_filter, #clear_filters, #filter_chip, #filter_ui, #generate_filters
#show_attachment_value, #show_field, #show_field_label, #show_field_value, #value_with_prefix_and_suffix
#available_actions
Instance Method Details
#checkbox_row(klass) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/cm_admin/view_helpers.rb', line 61
def checkbox_row(klass)
tag.div class: 'row' do
CmAdmin::Models::Export.exportable_columns(klass).each do |column_path|
concat create_checkbox(column_path)
end
end
end
|
#column_pop_up(klass, required_filters = nil) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/cm_admin/view_helpers.rb', line 24
def column_pop_up(klass, required_filters = nil)
tag.div class: 'modal fade form-modal', id: 'exportmodal', role: 'dialog', aria: { labelledby: 'exportModal' } do
tag.div class: 'modal-dialog modal-lg', role: 'document' do
tag.div class: 'modal-content' do
concat pop_ups(klass, required_filters)
end
end
end
end
|
#create_checkbox(column_path) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/cm_admin/view_helpers.rb', line 69
def create_checkbox(column_path)
tag.div class: 'col-md-4' do
concat check_box_tag 'columns[]', column_path, id: column_path.to_s.gsub('/', '-')
concat " #{column_path.to_s.gsub('/', '_').humanize}"
end
end
|
#exportable(_klass, html_class: []) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/cm_admin/view_helpers.rb', line 17
def exportable(_klass, html_class: [])
tag.a 'Export as excel', class: html_class.append('filter-btn modal-btn mr-2'), data: { toggle: 'modal', target: '#exportmodal' } do
concat tag.i class: 'fa fa-download'
concat tag.span ' Export'
end
end
|
#humanized_ar_collection_count(count, model_name) ⇒ Object
76
77
78
79
|
# File 'lib/cm_admin/view_helpers.rb', line 76
def humanized_ar_collection_count(count, model_name)
table_name = count == 1 ? model_name.singularize : model_name.pluralize
return "#{count} #{table_name.humanize.downcase} found"
end
|
#pop_up_body(klass, _required_filters) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/cm_admin/view_helpers.rb', line 50
def pop_up_body(klass, _required_filters)
tag.div class: 'modal-body' do
form_tag cm_admin.send('export_to_file_path'), id: 'export-to-file-form', style: 'width: 100%;', class: 'cm-admin-csv-export-form' do
concat hidden_field_tag 'class_name', klass.name.to_s, id: 'export-to-file-klass'
concat checkbox_row(klass)
concat tag.hr
concat submit_tag 'Export', class: 'btn btn-primary btn-bordered export-to-file-btn'
end
end
end
|
41
42
43
44
45
46
47
48
|
# File 'lib/cm_admin/view_helpers.rb', line 41
def
tag.div class: 'modal-header' do
tag.button type: 'button', class: 'close', data: { dismiss: 'modal' }, aria: { label: 'Close' } do
tag.span 'X', aria: { hidden: 'true' }
end
tag.h4 'Select columns to export', class: 'modal-title', id: 'exportModal'
end
end
|
#pop_ups(klass, required_filters) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/cm_admin/view_helpers.rb', line 34
def pop_ups(klass, required_filters)
tag.div do
concat
concat pop_up_body(klass, required_filters)
end
end
|