2014-04-13 11:16:51 +00:00
<div id="team-profile">
<h1 class="fancy">
<span><%=h @team.name %></span>
</h1>
<% if @team.logo %>
<div class="logo">
2014-04-21 18:19:03 +00:00
<%= image_tag @team.logo.url, class: 'logo', alt: h(@team.name) %>
2014-03-23 00:22:25 +00:00
</div>
2014-04-13 11:16:51 +00:00
<% end %>
2014-08-10 17:33:48 +00:00
<% if cuser && cuser.teamers %>
2017-03-03 13:09:14 +00:00
<%= form_for @teamer do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :user_id, :value => cuser.id %>
<%= f.hidden_field :team_id, :value => @team.id %>
<% if cuser.teamers.joining.count == 0 && @team.active %>
<div class="controls inline">
<%= f.submit "Request To Join", class: 'button' %>
</div>
<% elsif cuser.teamers.joining.first.team != @team %>
2014-08-10 17:33:48 +00:00
<div class="controls inline">
2017-03-03 13:09:14 +00:00
<%= f.submit "Request To Join", class: 'button', data: { confirm: "You have already requested to join #{cuser.teamers.joining.first.team}. Do you want to request to join #{@team} instead?" } %>
2014-08-10 17:33:48 +00:00
</div>
<% end %>
2014-05-13 23:54:51 +00:00
<% end %>
<% end %>
2014-04-13 11:16:51 +00:00
<div id="team" class="tabbed">
<ul id="team-nav" class="tabs">
<li><a href="#general">General</a></li>
<li><a href="#members">Members</a></li>
<li><a href="#matches">Matches</a></li>
<li><a href="#statistics">Statistics</a></li>
</ul>
<div class="tabbed-contents">
<div class="tab" id="general">
<dl>
2014-04-15 09:59:52 +00:00
<dt>IRC:</dt>
<dd><%=h @team.irc %></dd>
2014-04-13 11:16:51 +00:00
<dt>Web:</dt>
2014-04-15 09:59:52 +00:00
<dd><%=h @team.web %></dd>
2014-04-13 11:16:51 +00:00
<dt>Tag:</dt>
2014-04-15 09:59:52 +00:00
<dd><%=h @team.tag %></dd>
2014-04-13 11:16:51 +00:00
<dt>Country:</dt>
2014-04-15 09:59:52 +00:00
<dd><%=h @team.country %></dd>
2014-04-13 11:16:51 +00:00
<dt>Founder:</dt>
<dd><%= namelink @team.founder %></dd>
<dt>Comment:</dt>
2014-04-15 09:59:52 +00:00
<dd><%=h @team.comment %></dd>
2014-04-13 11:16:51 +00:00
<% if @team.recruiting %>
<dt>Recruiting:</dt>
2014-04-15 09:59:52 +00:00
<dd><%=h @team.recruiting %></dd>
2014-04-13 11:16:51 +00:00
<% end %>
</dl>
<%= link_to "Send a message", { controller: "messages", action: "new", id: "Team", id2: @team }, { class: 'button tiny' } %>
</div>
<div class="tab" id="members">
2014-04-26 00:20:34 +00:00
<% if @team.teamers.active.ordered.distinct.length > 0 %>
<h3>Current Members</h3>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.active.ordered.distinct, blacklist: false, comment: true } %>
<% end %>
2014-04-13 11:16:51 +00:00
2014-04-15 09:59:52 +00:00
<% if @team.teamers.past.distinct.length > 0 %>
<h3>Past Members</h3>
<%= render partial: "teamers/list", locals: { teamers: @team.teamers.past.distinct, blacklist: @team.teamers.active.ordered.distinct, comment: false } %>
<% end %>
2014-04-13 11:16:51 +00:00
</div>
<div class="tab" id="matches">
<% @team.contesters.chronological.each do |contester| %>
<% next if Match.finished.ordered.of_contester(contester).count == 0 %>
<h3>
<%= link_to contester.contest, contester.contest, :name => "contest_#{contester.contest.id}" %>
</h3>
<%= render partial: "matches/list", locals: { matches: Match.finished.ordered.of_contester(contester), friendly: contester.team, contest: false } %>
<% end %>
</div>
<div class="tab" id="matches">
<dl>
<dt>Matches:</dt>
2014-04-15 09:59:52 +00:00
<dd><%= @team.matches_finished.count %> played / <%= @team.matches.count %> total</dd>
2014-04-13 11:16:51 +00:00
<dt>Won:</dt>
<dd><%= @team.matches_won.count %> (<%= 100.0*@team.matches_won.count/@team.matches_finished.count %> %)</dd>
<dt>Lost:</dt>
<dd><%= @team.matches_lost.count %> (<%= 100.0*@team.matches_lost.count/@team.matches_finished.count %> %)</dd>
<dt>Draw:</dt>
<dd><%= @team.matches_draw.count %> (<%= 100.0*@team.matches_draw.count/@team.matches_finished.count %> %)</dd>
</dl>
</div>
2014-03-23 00:22:25 +00:00
</div>
2014-04-13 11:16:51 +00:00
</div>
2014-03-23 00:22:25 +00:00
2014-04-13 11:16:51 +00:00
<script type="text/javascript">
new Yetii({
id: 'team',
active: 2
});
</script>
2014-03-23 00:22:25 +00:00
2014-04-13 11:16:51 +00:00
<% if cuser and @team.can_update? cuser %>
<div class="controls">
<%= link_to 'Edit Team', edit_team_path(@team), class: 'button' %>
2014-03-23 00:22:25 +00:00
</div>
2014-04-13 11:16:51 +00:00
<% end %>
2014-03-23 00:22:25 +00:00
</div>