Sha256: fea4bea2c23b8edf985c7a8e7f4d2caade6105d5b1ecf3383e7f9dd57df8d669

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

- if actions.index(:new)
  - if EffectiveResources.authorized?(controller, :new, effective_resource.klass)
    - name = effective_resource.human_name.titleize
    = link_to "New #{name}", effective_resource.action_path(:new), title: "New #{name}", class: 'btn btn-primary'

- if actions.index(:edit)
  - if EffectiveResources.authorized?(controller, :edit, resource)
    = link_to 'Edit', effective_resource.action_path(:edit, resource), title: "Edit #{resource}", class: 'btn btn-secondary'

- if actions.index(:show)
  - if EffectiveResources.authorized?(controller, :show, resource)
    = link_to 'View', effective_resource.action_path(:show, resource), title: resource.to_s, class: 'btn btn-secondary'

- (actions - effective_resource.crud_actions).each do |action|
  - if effective_resource.member_post_actions.include?(action)
    - if EffectiveResources.authorized?(controller, action, resource)
      = link_to action.to_s.titleize, effective_resource.action_path(action, resource), class: 'btn btn-secondary',
        title: "#{action} #{resource}", data: { method: :post, confirm: "#{action.to_s.titleize} #{resource}?"}

  - elsif effective_resource.member_get_actions.include?(action)
    - if EffectiveResources.authorized?(controller, action, resource)
      = link_to action.to_s.titleize, effective_resource.action_path(action, resource), class: 'btn btn-secondary',
        title: "#{action.to_s.titleize} #{resource}"
  - else
    - if EffectiveResources.authorized?(controller, action, effective_resource.klass)
      = link_to action.to_s.titleize, effective_resource.action_path(action), class: 'btn btn-secondary',
        title: action.to_s.titleize

= yield if block_given?

- if actions.index(:destroy)
  - if EffectiveResources.authorized?(controller, :destroy, resource)
    = link_to 'Delete', effective_resource.action_path(:destroy, resource), class: 'btn btn-danger',
      title: "Delete #{resource}", data: { method: :delete, confirm: "Delete #{resource}?" }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
effective_resources-0.9.5 app/views/effective/resource/_actions.html.haml
effective_resources-0.9.4 app/views/effective/resource/_actions.html.haml
effective_resources-0.9.3 app/views/effective/resource/_actions.html.haml
effective_resources-0.9.2 app/views/effective/resource/_actions.html.haml