summaryrefslogtreecommitdiff
path: root/app/views/shared/_index_view_edit_destroy_part.html.haml
blob: d3964602bc8ae7aa447cfd735b014a0fa6b2f6d2 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
- if !(defined? parent).nil? && !(defined? child).nil?
  %td
    %span{:style => 'white-space: nowrap'}
      - if can? :show, child
        %a.btn.btn-small.btn-success{:href => method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child) }
          %i.icon-info-sign.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.show")

      - if can? :edit, child
        %a.btn.btn-small.btn-warning{:href => method( :"edit_#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child) }
          %i.icon-edit.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.edit")

      - if can? :destroy, child
        %a.btn.btn-small.btn-danger{"data-confirm" => t("#{child.class.name.underscore.pluralize}.index.actions.confirm_destroy"), "data-method" => "delete", :href => method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child), :rel => "nofollow"}
          %i.icon-remove.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")

- elsif !(defined? child).nil?
  %td
    %span{:style => 'white-space: nowrap'}
      - if can? :show, child
        %a.btn.btn-small.btn-success{:href => method( :"#{child.class.name.underscore}_path" ).(child) }
          %i.icon-info-sign.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.show")

      - if can? :edit, child
        %a.btn.btn-small.btn-warning{:href => method( :"edit_#{child.class.name.underscore}_path" ).(child) }
          %i.icon-edit.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.edit")
          
      - if can? :destroy, child
        %a.btn.btn-small.btn-danger{"data-confirm" => t("#{child.class.name.underscore.pluralize}.index.actions.confirm_destroy"), "data-method" => "delete", :href => method( :"#{child.class.name.underscore}_path" ).(child), :rel => "nofollow"}
          %i.icon-trash.icon-white
          %span.hidden-phone
            =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")