Sha256: beef2b1a32ab5647ade816d8c52644e621d2770492d0177d53e74dc37beb3fdd
Contents?: true
Size: 1.95 KB
Versions: 36
Compression:
Stored size: 1.95 KB
Contents
-# = dropdown(variation: :dropleft, btn_class: btn_class) do -# - authorized_resource_actions(resource, for_action: action_name).select{ |x| x.show_in_datatable }.each do |a| -# - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id) -# - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {} -# = dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data - actions = authorized_resource_actions(resource, for_action: action_name).select{ |x| x.show_in_datatable } - primary_actions = actions.select{ |a| a.primary } - non_primary_actions = actions.select{ |a| !a.primary } .btn-group - if non_primary_actions.size.positive? .btn-group %button.btn.btn-sm.dropdown-toggle{ type: :button, data: { toggle: 'dropdown' }} %ul.dropdown-menu - non_primary_actions.each do |a| - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id) - hash = {} - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame, turbo_method: a.verb } : {} - hash[:data] = data - hash[:method] = a.verb unless a.turbo_frame.present? %li = dropdown_link_to resource_form_action_label(resource, a.sym), path, hash - primary_actions.each do |a| - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id) - icon_class = (a.verb == :delete ? '' : '') = link_to path, a.args_hash(title: resource_form_action_tooltip(resource, a.sym), class: "btn btn-sm #{icon_class}") do - action_label = resource_form_action_label(resource, a.sym) - icon_font_size = action_label.blank? ? '18px' : '10px' %i{ class: resource_form_action_icon(resource, a.sym), style: "display: block; font-size: #{icon_font_size}" } - unless action_label.blank? %span{ style: 'font-size: 12px' }= action_label
Version data entries
36 entries across 36 versions & 1 rubygems