YaleSTC/shifts

View on GitHub
app/views/payforms/show.html.erb

Summary

Maintainability
Test Coverage
<% payform_span = start_of_period(@payform.date).strftime(date_format)+ " through " + @payform.date.strftime(date_format) %>
<% if current_user.is_admin_of?(current_department) %>
  <% if @payform.user.roles.empty? %>
    <% title @payform.user.name + ' (No roles have been defined for this user)' %>
  <% else %>
    <% title "#{@payform.user.name + ' (' + @payform.user.roles.collect(&:name).join(',') + ')'}" %>
  <% end %>  
<% else %>
  <% title "Your Payform" %>
<% end %>
<h2><%= "#{payform_span}" %></h2><br/>

<% unless current_user.is_admin_of?(current_department) %>
   <div id="cols">
     <div id="cols-header"><%= error_messages_for 'payform' %></div>
     <div id="left-col"><%= render partial: 'date_select', locals: {date: @payform.date } %></div>
     <div id="right-col"><%= link_to "<span>View all past payforms</span>".html_safe, payforms_path, :class=>"button" %></div>
     <div id="middle-col"></div>
     <div id="cols-footer"></div>
    </div>
    <br /><br />
  <% end %>
  <div id="payform_status">
    <%= render partial: "status" %>
  </div>
  <br />

  <div id="payform_buttons">
    <%= render partial: "payform_buttons" %>
  </div>

  <div id="payform">
     <h1>Payform Items</h1>
         <table id="payformList">
              <%= render partial: "category", collection: (@payform.department.categories) %>
              <tfoot> <tr> <th scope="col" id="hours" colspan=7>
                 Total Time: <div class="total-hours-right"><%= @payform.hours %></div>
              </th></tr> </tfoot>
         </table>
      <br/>
  </div>

<%= payform_add_button %>