hpi-schuelerklub/workshop-portal

View on GitHub
app/views/application_letters/index.html.erb

Summary

Maintainability
Test Coverage
<%- model_class = ApplicationLetter -%>
<div class="page-header">
  <h1><%= t '.title', :default => model_class.model_name.human(:count => model_class.count).titleize %></h1>
</div>
<table class="table table-striped">
  <thead>
  <tr>
    <th><%= Event.model_name.human(:count => model_class.count).titleize %></th>
    <th><%= model_class.human_attribute_name(:status) %></th>
    <th><%= t '.actions', :default => t("helpers.actions") %></th>
  </tr>
  </thead>
  <tbody>
  <% @application_letters.each do |application| %>
      <tr>
        <td><%= link_to application.event.name, event_path(application.event) %></td>
        <% if current_user.present? && current_user.role == 'pupil' && application.event.phase == :selection %>
          <td><%= t('application_status.pending_after_deadline') %></td>
        <% else %>
          <td><%= application.status_type %></td>
        <% end %>
        <td>
        <%= link_to t('.details'),
                      check_application_letter_path(application), :class => 'btn btn-default btn-xs' %>
          <% if not application.after_deadline? %>
              <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
                          application_letter_path(application),
                          :method => :delete,
                          :data => {:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => t("application_letters.confirmApplicationDelete")))},
                          :class => 'btn btn-xs btn-danger' %>
          <% end %>
        </td>
      </tr>
  <% end %>
  </tbody>
</table>