-
Notifications
You must be signed in to change notification settings - Fork 13
/
show.html.erb
85 lines (75 loc) · 3.71 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<%- 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><%= @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' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_application_letter_path(@application_letter), :class => 'btn btn-default' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
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' %>
<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>
<%= @application_letter.motivation %>
</p>
<% if can? :view_and_add_notes, ApplicationLetter %>
<dl class="dl-horizontal">
<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 %>