summaryrefslogtreecommitdiff
path: root/app/views/shared/_index_view_edit_destroy_part.html.haml
blob: 06ec9041e84c3912a19cb8564af8ce14a6406aa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- style = 'width:35px'

- if !(defined? parent).nil? && !(defined? child).nil?
  %td{ :style => style }
    - if can? :show, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.show"), method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child)
  %td{ :style => style }
    - if can? :edit, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.edit"), method( :"edit_#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child)
  %td{ :style => style }
    - if can? :destroy, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.destroy"), method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child), :method => :delete
  - if child.respond_to?(:move_up?) or child and child.respond_to?(:move_down?)
    %td{ :style => style }
      - if can? :move_down, child and child.respond_to?(:move_down?) and child.move_down?
        = link_to '⇩'.html_safe, method( :"move_lower_#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child), :method => :put
      - if can? :move_up, child and child.respond_to?(:move_up?) and child.move_up?
        = link_to '⇧'.html_safe, method( :"move_higher_#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child), :method => :put

- elsif !(defined? child).nil?
  %td{ :style => style }
    - if can? :show, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.show"), method( :"#{child.class.name.underscore}_path" ).(child)
  %td{ :style => style }
    - if can? :edit, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.edit"), method( :"edit_#{child.class.name.underscore}_path" ).(child)
  %td{ :style => style }
    - if can? :destroy, child
      = link_to t("#{child.class.name.underscore.pluralize}.index.actions.destroy"), method( :"#{child.class.name.underscore}_path" ).(child), :method => :delete