app/views/application_letters/show.html.erb
<%- model_class = ApplicationLetter -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human.titleize %></h1>
</div>
<% if can? :show, @application_letter.user.profile %>
<h3><%= link_to @application_letter.user.profile.name, profile_path(@application_letter.user.profile) %></h3>
<% else %>
<h3><%= @application_letter.user.profile.name %></h3>
<% end %>
<dl class="dl-horizontal" id="applicant_details">
<dt><strong><%= Profile.human_attribute_name(:gender) %>:</strong></dt>
<dd><%= t("profiles.genders.#{@application_letter.user.profile.gender}") %></dd>
<dt><strong><%= t('.age_when_event_starts') %>:</strong></dt>
<dd><%= @application_letter.user.profile.age_at_time(@application_letter.event.start_date) %></dd>
<% if can? :view_personal_details, ApplicationLetter %>
<dt><strong><%= Profile.human_attribute_name(:address) %>:</strong></dt>
<dd><%= @application_letter.user.profile.address %></dd>
<% end %>
<dt><strong><%= User.human_attribute_name(:accepted_application_count) %>:</strong></dt>
<dd><%= @application_letter.user.accepted_applications_count(@application_letter.event) %></dd>
<dt><strong><%= User.human_attribute_name(:rejected_application_count) %>:</strong></dt>
<dd><%= @application_letter.user.rejected_applications_count(@application_letter.event) %></dd>
</dl>
<%= link_to t('.back', :default => t("helpers.links.back")),
application_letters_path, :class => 'btn btn-default' %>
<% if can? :edit, ApplicationLetter %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_application_letter_path(@application_letter), :class => 'btn btn-default' %>
<% end %>
<h3><%= t('.application_title', title: @application_letter.event.name) %></h3>
<dl class="dl-vertical">
<dt><%= render partial: 'application_letters/application_selective', locals: {application_letter: @application_letter} %></dt>
</dl>
<p>
<h5><%= ApplicationLetter.human_attribute_name(:motivation) %></h5>
<%= simple_format(@application_letter.motivation) %>
</p>
<% unless @application_letter.annotation.nil? %>
<p>
<h5><%= t('.annotation_title') %></h5>
<%= @application_letter.annotation %>
</p>
<% end %>
<% @application_letter.event.custom_application_fields
.zip(@application_letter.custom_application_fields)
.each do |field_name, field_value| %>
<p>
<h5><%= field_name %>:</h5>
<%= field_value %>
<p>
<% end %>
<br>
<% if can? :view_and_add_notes, ApplicationLetter %>
<dl class="dl-horizontal" id="application-notes">
<dt><strong><%= ApplicationNote.model_name.human(count: @application_letter.application_notes.count) %>:</strong></dt>
<dd><% @application_letter.application_notes.each do |note| %>
<div> <%= note.note %> </div>
<% end %></dd>
</dl>
<%= form_for [@application_letter, @application_letter.application_notes.build], :html => { :class => "form-horizontal application" } do |f| %>
<% if @application_note.errors.any? %>
<div id="error_expl" class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title"><%= pluralize(@application_note.errors.count, "error") %> prohibited this application from being saved:</h3>
</div>
<div class="panel-body">
<ul>
<% @application_note.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
</div>
<% end %>
<div class="form-group">
<%= f.label :note, t(".new_note"), :class => 'control-label col-lg-2' %>
<div class="col-lg-10">
<%= f.text_area :note, :class => 'form-control' %>
</div>
<%=f.error_span(:note) %>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<%= f.submit nil, :class => 'btn btn-primary' %>
</div>
</div>
<% end %>
<% end %>
<% if can? :view_delete_button, ApplicationLetter %>
<%= link_to t('.destroy', :default => t("application_letters.show.delete")),
application_letter_path(@application_letter),
:method => 'delete',
:data => { :confirm => t('.confirm', :default => t("application_letters.confirm_deletion", :default => 'Are you sure?')) },
:class => 'btn btn-danger' %>
<% end %>