%h1 Listing commands

%table
  %thead
    %tr
      %th
      %th Name
      %th Trigger
      - if policy(Command).edit?
        %th Body
        %th
        %th

  %tbody
    - @commands.each do |command|
      %tr
        %td= link_to 'Run', run_command_path(command)
        %td= command.display_name
        %td= command.trigger
        - if policy(command).edit?
          %td= command.body
          %td= link_to 'Edit', edit_command_path(command)
          %td= link_to 'Destroy', command, method: :delete, data: { confirm: 'Are you sure?' }

- if policy(Command).new?
  = link_to 'New Command', new_command_path
