Skip to content

Commit

Permalink
#5 Create a first version of team ranking view.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Fürschuß committed Nov 23, 2016
1 parent cef90c4 commit bb640e5
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/Wuzlstats/Views/Teams/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@model Wuzlstats.ViewModels.Teams.IndexViewModel

@if (Model.Recent)
{
<p class="help-block">
These are the teams of the last @Model.Days days. All of them.<br />This is pretty sweet, but it gets better: There's also
<a href="@Url.Action("Index", "Teams", new { sort = Model.ActiveFilter, recent = false })">this very same statistic, but for all of the time</a>. All of it. Holy crap!
</p>
}
else
{
<p class="help-block">
These are all the players. Ever.<br />No one will be forgotten. Shame and fame will last till the very end of days, or at least until a database crash with no backups. <br />
There's the same statistic, <a href="@Url.Action("Index", "Teams", new { sort = Model.ActiveFilter, recent = true })">but only for the last @Model.Days days</a>, too.
</p>
}

<div class="input-group">
Order By
<div class="btn-group">
<a href="@Url.Action("Index", "Teams", new { recent = Model.Recent })" class="btn btn-default btn-sm @(string.IsNullOrEmpty(Model.ActiveFilter) ? "active" : "")">Last played</a>
<a href="@Url.Action("Index", "Teams", new { sort = "best", recent = Model.Recent })" class="btn btn-default btn-sm @(Model.ActiveFilter == "best" ? "active" : "")">Best</a>
<a href="@Url.Action("Index", "Teams", new { sort = "worst", recent = Model.Recent })" class="btn btn-default btn-sm @(Model.ActiveFilter == "worst" ? "active" : "")">Worst</a>
<a href="@Url.Action("Index", "Teams", new { sort = "activity", recent = Model.Recent })" class="btn btn-default btn-sm @(Model.ActiveFilter == "activity" ? "active" : "")">Most active</a>
</div>
</div>

<table class="table table-striped ranking teams">
<thead>
<tr>
<th></th>
<th>Team</th>
<th>Score</th>
<th>Last game</th>
<th>Count</th>
</tr>
</thead>
<tbody>
@{var rank = 1; }
@foreach (var team in Model.Teams)
{
<tr>
<td>
@(rank++)
</td>
<td>
@Html.Partial("_Player", team.Player1)
@Html.Partial("_Player", team.Player2)
</td>
<td>
<div class="player-score">
<span class="ranking-wins">@team.Wins<span class="glyphicon glyphicon-thumbs-up"></span></span>
<span class="ranking-losses">@team.Losses<span class="glyphicon glyphicon-thumbs-down"></span></span>
</div>
</td>
<td>
@team.LastGamePlayedOn.ToShortDateString()
</td>
<td>
@team.GamesCount
</td>
</tr>
}
</tbody>
</table>
8 changes: 8 additions & 0 deletions src/Wuzlstats/Views/Teams/_Player.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@model Wuzlstats.ViewModels.Teams.PlayerViewModel

<div class="player">
<a href="@Url.Action("Index", "Player", new { id = Model.Id })">
<img src="data:image/png;base64,@Model.Image" alt="@Model.Name" class="ranking-image" />
</a>
<div class="player-name">@Model.Name</div>
</div>

0 comments on commit bb640e5

Please sign in to comment.