Module: Spree::Admin::BulkOperationsHelper
- Defined in:
- app/helpers/spree/admin/bulk_operations_helper.rb
Instance Method Summary collapse
-
#bulk_action_link(text, path, options = {}) ⇒ String
render a link to perform a bulk action.
-
#bulk_operations_checkbox(object) ⇒ String
render a checkbox to select an item for bulk operations.
-
#bulk_operations_close_button ⇒ Object
render a close button for the bulk modal.
-
#bulk_operations_counter ⇒ String
render a counter for the bulk operations.
-
#bulk_operations_select_all_checkbox ⇒ String
render a checkbox to select all items for bulk operations.
Instance Method Details
#bulk_action_link(text, path, options = {}) ⇒ String
render a link to perform a bulk action
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/helpers/spree/admin/bulk_operations_helper.rb', line 46 def bulk_action_link(text, path, = {}) [:data] ||= {} [:data][:action] ||= 'click->bulk-operation#setBulkAction click->bulk-dialog#open' [:data][:turbo_frame] ||= :bulk_dialog [:data][:url] ||= [:url] [:class] ||= 'btn' tooltip_text = nil if [:icon] if [:only_icon] tooltip_text = [:title] || text text = icon([:icon], class: 'mr-0') [:data][:controller] = 'tooltip' .delete(:title) else text = icon([:icon]) + ' ' + text end end link_content = text link_content += tooltip(tooltip_text) if tooltip_text link_to link_content, path, end |
#bulk_operations_checkbox(object) ⇒ String
render a checkbox to select an item for bulk operations
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/spree/admin/bulk_operations_helper.rb', line 23 def bulk_operations_checkbox(object) content_tag :div, class: "custom-control form-checkbox ml-1" do check_box_tag( "ids[]", object.id, false, class: "custom-control-input", id: "ids_#{object.id}", data: { bulk_operation_target: "checkbox" } ) + content_tag(:label, content_tag(:span, ""), class: "custom-control-label", for: "ids_#{object.id}") end end |
#bulk_operations_close_button ⇒ Object
render a close button for the bulk modal
72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/helpers/spree/admin/bulk_operations_helper.rb', line 72 def ( '', type: 'button', class: 'btn-close mr-1', data: { action: 'bulk-operation#cancel', aria_label: Spree.t(:close) } ) end |
#bulk_operations_counter ⇒ String
render a counter for the bulk operations
86 87 88 89 90 91 92 93 |
# File 'app/helpers/spree/admin/bulk_operations_helper.rb', line 86 def bulk_operations_counter content_tag(:div, class: 'bulk-operations-counter') do content_tag(:span, class: 'bulk-operations-counter-label') do content_tag(:strong, '', data: { bulk_operation_target: 'counter' }) + Spree.t("admin.selected") end end end |
#bulk_operations_select_all_checkbox ⇒ String
render a checkbox to select all items for bulk operations
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/spree/admin/bulk_operations_helper.rb', line 6 def bulk_operations_select_all_checkbox content_tag :div, class: "custom-control form-checkbox ml-1" do check_box_tag( nil, nil, false, id: "checkAllMasterCheckbox", class: "custom-control-input", data: { bulk_operation_target: "checkboxAll" } ) + content_tag(:label, content_tag(:span, ""), class: "custom-control-label", for: "checkAllMasterCheckbox") end end |