Sha256: a0d3b7ea845972381ce79f772721d43e0b9d26e633237551c478b9ed1eadf8af

Contents?: true

Size: 1.88 KB

Versions: 6

Compression:

Stored size: 1.88 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)
    - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
    - icon_class = (a.verb == :delete ? '' : '')
    = link_to path, data: data, method: a.verb, 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

6 entries across 6 versions & 1 rubygems

Version Path
five-two-nw-olivander-0.1.2.51 app/views/effective/resource/_actions_dropleft.html.haml
five-two-nw-olivander-0.1.2.50 app/views/effective/resource/_actions_dropleft.html.haml
five-two-nw-olivander-0.1.2.49 app/views/effective/resource/_actions_dropleft.html.haml
five-two-nw-olivander-0.1.2.48 app/views/effective/resource/_actions_dropleft.html.haml
five-two-nw-olivander-0.1.2.47 app/views/effective/resource/_actions_dropleft.html.haml
five-two-nw-olivander-0.1.2.46 app/views/effective/resource/_actions_dropleft.html.haml