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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
@model Project_Unite.Models.Contest
@using Microsoft.AspNet.Identity
@{
ViewBag.Title = "Contest: " + Model.Name;
}
<h2>@Model.Name</h2>
<style>
.text-bronze {
color: #cd7f32;
}
.text-silver {
color: #C0C0C0;
}
.text-gold {
color: #FFD700;
}
</style>
<div class="row">
<div class="col-xs-9">
@if (!string.IsNullOrWhiteSpace(Model.VideoId))
{
<iframe width="560" height="315" src="https://www.youtube.com/embed/@Model.VideoId" frameborder="0" allowfullscreen></iframe>
}
@if (Model.IsEnded)
{
<h3>This contest has ended on @Model.EndsAt</h3>
}
else
{
<h3>This contest is open - and will be closed at @Model.EndsAt</h3>
}
<p>@Html.Markdown(Model.Description)</p>
<h3>Contest rewards:</h3>
<dl>
<dt class="text-gold">Gold:</dt><dd>@Model.CodepointReward1st Codepoints</dd>
<dt class="text-silver">Silver:</dt>
<dd>@Model.CodepointReward2nd Codepoints</dd>
<dt class="text-bronze">Bronze:</dt>
<dd>@Model.CodepointReward3rd Codepoints</dd>
</dl>
<h3>Submissions</h3>
<p>Below is a list of all submissions for this contest.</p>
<div class="row">
<div class="col-xs-8"><strong>Submission</strong></div>
<div class="col-xs-4"><strong>Actions</strong></div>
</div>
@if(Model.Entries.Length == 0)
{
<p>There are no submissions for this contest. Be the first!</p>
}
else
{
foreach(var c in Model.Entries)
{
<div class="row">
<div class="col-xs-8">
@Html.ActionLink(c.Name, "ViewSubmission", "Contests", new { id=c.Id}, null) <br/>
<p>By @Html.UserLink(c.AuthorId) on @c.PostedAt • <span class="glyphicon glyphicon-thumbs-up"></span> @c.Upvotes.Length • <span class="glyphicon glyphicon-thumbs-down"></span> @c.Downvotes.Length</p>
@if (c.Disqualified)
{
<p><strong>This submission has been disqualified by @Html.UserLink(c.DisqualifiedBy) - Reason:</strong><br/>@c.DisqualifiedReason</p>
}
</div>
<div class="col-xs-4">
@if (!string.IsNullOrWhiteSpace(c.VideoId))
{
<a href="http://youtube.com/[email protected]" class="btn btn-default"><span class="glyphicon glyphicon-hd-video"></span> Watch video</a>
}
@if (!string.IsNullOrWhiteSpace(c.DownloadURL))
{
<a href="@c.DownloadURL" class="btn btn-default"><span class="glyphicon-arrow-down"></span> Download</a>
}
@if (User.Identity.IsAdmin() && c.Disqualified == false)
{
@Html.ActionLink("Disqualify", "Disqualify", "Contests", new { id=c.Id}, new { @class="btn btn-danger"})
}
</div>
</div>
}
}
</div>
<div class="col-xs-3">
<h4>Want to win this contest?</h4>
@if (!Model.UserSubmitted(User.Identity.GetUserId()))
{
if (Model.IsEnded)
{
<p>Unfortunately, this contest has ended and you cannot submit an entry. Perhaps there's another contest still going?</p>
}
else
{
<p>Good news! This contest is still open. Hurry and submit your entry!</p>
<a href="@Url.Action("SubmitEntry", "Contests", new { id = Model.Id })" class="btn-primary btn"><span class="glyphicon glyphicon-arrow-right"></span> Go, go, go! Submit an entry!</a>
}
}
else
{
<p>You have already submitted an entry for this contest.</p>
}
<h4>Current winners:</h4>
@{
var toptobottom = Model.Entries.OrderByDescending(x => (x.Upvotes.Length - x.Downvotes.Length));
}
@if(toptobottom.Count() >= 3)
{
var first = toptobottom.ToArray()[0];
var second = toptobottom.ToArray()[1];
var third = toptobottom.ToArray()[2];
<dl>
<dt class="text-gold">First place:</dt>
<dd>@first.Name by @Html.UserLink(first.AuthorId)</dd>
<dt class="text-silver">Second place:</dt>
<dd>@second.Name by @Html.UserLink(second.AuthorId)</dd>
<dt class="text-bronze">Third place:</dt>
<dd>@third.Name by @Html.UserLink(third.AuthorId)</dd>
</dl>
}
else
{
<p>Not enough people have entered into this contest.</p>
}
</div>
</div>
|