app/views/menus/index.html.erb
<div class="row at-actions-wrapper">
<div class="col-xs-5 col-xs-offset-1">
<% if can? :call, Menus::CreateController %>
<%= link_to 'Create', new_menu_path, class: "btn btn-default btn-xm at-btn-dark" %>
<% end %>
</div>
<div class="col-xs-5 text-right">
<%= will_paginate @menus, inner_window: 0, outer_window: 0 %>
</div>
</div>
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<% @menus.each do |menu| %>
<div class="at-list-item">
<span><%= menu.week_description %></span>
<div class="pull-right">
<%= link_to 'View', menu_path(menu), class: "btn btn-default btn-xs at-btn-xs-light", role: "button" %>
<% if menu.draft? %>
<% if can? :call, Menus::UpdateController %>
<%= link_to 'Edit', edit_menu_path(menu), class: "btn btn-default btn-xs at-btn-xs-light", role: "button" %>
<% end %>
<% if can? :call, Menus::PublishController %>
<%= link_to 'Publish', publish_menu_path(menu), method: :put, class: "btn btn-default btn-xs at-btn-xs-dark", role: "button" %>
<% end %>
<% end %>
<% if menu.published? %>
<% if can? :call, Menus::FillController %>
<%= link_to 'Fill', fill_menu_path(menu), class: "btn btn-default btn-xs at-btn-xs-dark", role: "button" %>
<% end %>
<% if can? :call, Menus::CloseController %>
<%= link_to 'Close', close_menu_path(menu), method: :put, class: "btn btn-default btn-xs at-btn-xs-dark", role: "button" %>
<% end %>
<% if can? :call, Orders::ShowController %>
<%= link_to 'Results', orders_path(menu), class: "btn btn-default btn-xs at-btn-xs-dark", role: "button" %>
<% end %>
<% end %>
<% if menu.closed? %>
<% if can? :call, Orders::ShowController %>
<%= link_to 'Results', orders_path(menu), class: "btn btn-default btn-xs at-btn-xs-dark", role: "button" %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
</div>