ensl.org/app/views/teams/edit.html.erb
2015-11-06 15:23:50 +00:00

114 lines
3.4 KiB
Text

<div id="teams" class="tabbed edit">
<h1>Manage Team: <%=h @team.name %></h1>
<ul id="teams-nav" class="tabs">
<li><a href="#details">Details</a></li>
<li><a href="#members">Members</a></li>
<li><a href="#contests">Contests</a></li>
</ul>
<div class="tabbed-contents">
<div id="details" class="tab">
<%= form_for @team, html: { multipart: true, class: 'square' } do |f| %>
<%= f.error_messages %>
<div class="fields horizontal">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div class="fields horizontal">
<%= f.label :irc %>
<%= f.text_field :irc %>
</div>
<div class="fields horizontal">
<%= f.label :web %>
<%= f.text_field :web %>
</div>
<div class="fields horizontal">
<%= f.label :tag %>
<%= f.text_field :tag %>
</div>
<div class="fields horizontal">
<%= f.label :country %>
<%= country_code_select :team, :country, [['EU', 'EU']] %>
</div>
<div class="fields horizontal">
<%= f.label :comment %>
<%= f.text_field :comment %>
</div>
<div class="fields horizontal">
<%= f.label :recruiting %>
<div class="inputs">
<%= f.text_field :recruiting %>
<p>Leave empty if you are not recruiting, or enter your recruiting criteria above.</p>
</div>
</div>
<div class="fields horizontal">
<%= f.label :logo %>
<%= f.file_field :logo %>
</div>
<div class="controls">
<%= f.submit "Update" %>
</div>
<% end %>
</div>
<div id="members" class="tab">
<%= form_for @team do |f| %>
<table class="data">
<tr>
<th>Name</th>
<th>Comment</th>
<th>Rank</th>
<th>Actions</th>
</tr>
<% @team.teamers.present.each do |member| %>
<tr class="fields">
<td id="<%= 'primary' if member.team_id == member.user.team_id %>">
<%= link_to (h member.user.username), member.user %>
</td>
<td>
<%= text_field_tag "comment[#{member.id}]", (h member.comment) %>
</td>
<td>
<%= select_tag "rank[#{member.id}]", options_for_select(member.ranks.invert, member.rank) %>
</td>
<td>
<%= link_to member, confirm: 'Are you sure?', method: :delete, class: 'button tiny' do %>
<%= icon 'times' %> Remove
<% end %>
</td>
</tr>
<% end %>
</table>
<div class="controls">
<%= f.submit "Update" %>
</div>
<% end %>
</div>
<div id="contests" class="tab">
<p>
<%= form_for @team.contesters.build, html: { class: 'square' } do |f| %>
<%= f.hidden_field :team_id %>
<div class="fields inline">
<%= f.collection_select :contest_id, Contest.active, :id, :name %>
</div>
<div class="controls inline">
<%= f.submit "Join" %>
</div>
<% end %>
</p>
</div>
</div>
</div>
<script type="text/javascript">
new Yetii({
id: 'teams'
});
</script>
<%= link_to 'Show', @team, class: 'button' %>
<%= link_to 'Back', teams_path, class: 'button' %>