%h1 Listing campaigns

%table.table
  %tr
    %th
    %th Name
    %th Description
    %th Game master
    %th

  - campaigns.each do |campaign|
    %tr
      %td{ style: 'text-align: center' }
        - if campaign.users.include? current_user
          = link_to 'Resign', resign_campaign_path(campaign), class: 'btn btn-danger'
        - else
          = link_to 'Join', join_campaign_path(campaign), class: 'btn btn-success'
      %td= campaign.name
      %td= campaign.description
      %td= campaign.game_master

      %td
        .btn-group
          = link_to 'Show', campaign, class: 'btn btn-default'
          - if current_user == campaign.game_master
            = link_to 'Edit', edit_campaign_path(campaign), class: 'btn btn-primary'
            = link_to 'Destroy', campaign, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'

%br

= link_to 'New Campaign', new_campaign_path

%h1 Listing campaigns

%table.table
  %tr
    %th
    %th Name
    %th Description
    %th Game master
    %th

  - campaigns.each do |campaign|
    %tr
      %td{ style: 'text-align: center' }
        - if campaign.users.include? current_user
          = link_to 'Resign', resign_campaign_path(campaign), class: 'btn btn-danger'
        - else
          = link_to 'Join', join_campaign_path(campaign), class: 'btn btn-success'
      %td= campaign.name
      %td= campaign.description
      %td= campaign.game_master

      %td
        .btn-group
          = link_to 'Show', campaign, class: 'btn btn-default'
          - if policy(campaign).edit?
            = link_to 'Edit', edit_campaign_path(campaign), class: 'btn btn-primary'
          - if policy(campaign).destroy?
            = link_to 'Destroy', campaign, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'

%br

= link_to 'New Campaign', new_campaign_path

Use policies in campaign index view
Use policies in campaign index view
