Sha256: 7d8b075b6083326b90f8ffcd8743301993a3496b50f3153ea4d43508249b114c
Contents?: true
Size: 1.78 KB
Versions: 10
Compression:
Stored size: 1.78 KB
Contents
- route_builder = @context&.route_builder || datatable.class::ROUTE_BUILDER -# = dropdown(variation: :dropleft, btn_class: btn_class) do -# - authorized_resource_actions(route_builder, 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(route_builder, resource, for_action: action_name).select{ |x| x.show_in_datatable } - crud_actions = actions.select{ |a| a.crud_action } - non_crud_actions = actions.select{ |a| !a.crud_action } .btn-group - if non_crud_actions.size.positive? .btn-group %button.btn.btn-sm.dropdown-toggle{ type: :button, data: { toggle: 'dropdown' }} %ul.dropdown-menu - non_crud_actions.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 } : {} %li = dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data, method: a.verb - crud_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_label(resource, a.sym), class: "btn btn-sm #{icon_class}") do %i{ class: resource_form_action_icon(resource, a.sym), style: 'display: block; font-size: 10px' } %span{ style: 'font-size: 12px' }= resource_form_action_label(resource, a.sym)
Version data entries
10 entries across 10 versions & 1 rubygems