ensl.org/app/views/matches/show.html.erb

136 lines
4.1 KiB
Text
Raw Permalink Normal View History

<div id="match">
<div class="contesters">
<% if @match.score1 and @match.score2 %>
<h1 class="team-1"><%= namelink @match.contester1.team if @match.contester1 %></h1>
<div class="versus split">
<div class="score-1">
<%= h @match.score1 %>
</div>
<span class="vs"></span>
<div class="score-2">
<%= h @match.score2 %>
</div>
</div>
<h1 class="team-2"><%= namelink @match.contester2.team if @match.contester2 %></h1>
<% else %>
<h1 class="team-1"><%= namelink @match.contester1.team if @match.contester1 %></h1>
<div class="versus">
<span class="vs">VS</span>
</div>
<h1 class="team-2"><%= namelink @match.contester2.team if @match.contester2 %></h1>
<% end %>
</div>
<% if @match.team1_lineup.any? || @match.team2_lineup.any? %>
<div class="lineups <%= 'shift' if !@match.team1_lineup.any? %>">
<% if @match.team1_lineup.any? %>
<div class="team-1">
<ul>
<% @match.team1_lineup.each do |teamer| %>
<li>
<% if teamer.user == @match.motm %>
<%= icon 'star' %>
<% end %>
<%= teamer.user.username %>
<%= flag teamer.user.country %>
</li>
<% end %>
</ul>
</div>
<% end %>
<% if @match.team2_lineup.any? %>
<div class="team-2">
<ul>
<% @match.team2_lineup.each do |teamer| %>
<li>
<%= flag teamer.user.country %>
<%= teamer.user.username %>
<% if teamer.user == @match.motm %>
<%= icon 'star' %>
<% end %>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>
<% end %>
<div class="details">
<h3 class="contest"><%= @match.contest %></h3>
<h5 class="date"><%= @match.match_time.strftime("%A %e %B %Y") %></h5>
<h5 class="date"><%= Time.use_zone(timezone_offset) { @match.match_time.strftime("%H:%M %Z") } %></h5>
</div>
<div class="predictions">
<h4>Predictions (<%= @match.predictions.count %>)</h4>
<% if @newpred.can_create? cuser %>
<%= form_for @newpred do |f| %>
<%= f.hidden_field :match_id %>
<div class="fields">
<div class="team-1">
<%= f.text_field :score1, size: 1, placeholder: 0 %>
</div>
<div class="team-2">
<%= f.text_field :score2, size: 1, placeholder: 0 %>
</div>
</div>
<div class="add">
<%= submit_tag "Add Prediction", class: 'button tiny' %>
</div>
<% end %>
<% else %>
<div class="team-1">
<%= @match.contester1.team if @match.contester1 %>
<div class="highlight"><%= @match.preds(1) %>%</div>
</div>
<div class="team-2">
<div class="highlight"><%= @match.preds(2) %>%</div>
<%= @match.contester2.team if @match.contester2 %>
</div>
<% end %>
</div>
<div class="details">
<%= cascade @match, [:server, :demo, :referee] %>
<strong>Maps</strong><br>
<%= namelink @match.map1 %>, <%= namelink @match.map2 %>
2014-05-10 08:44:48 +00:00
<% if @match.caster && @match.caster.profile.stream %>
<dl>
<dt>Stream</dt>
<dd>
<%= link_to @match.caster.profile.stream, @match.caster.profile.stream %>
</dd>
</dl>
<% end %>
</div>
<% unless @match.report.nil? or @match.report.empty? %>
<div class="report">
<h3>Match Report</h3>
<p><%= @match.report.html_safe %></p>
</div>
<% end %>
<% if cuser and @match.can_update? cuser, [:report] %>
<div class="referee">
<%= link_to "Referee Admin", match_ref_path(@match), class: 'button' %>
</div>
<% end %>
<% if cuser and @match.referee.nil? and cuser.ref? %>
<div class="referee">
<%= form_for @match do |f| %>
<%= f.hidden_field :referee_id, value: cuser.id %>
<%= f.submit "Signup as referee", class: 'button' %>
<% end %>
</div>
<% end %>
</div>
<%= add_comments @match %>