-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make last post link cover the username as well, makes it easier to click and makes more sense in the context anyway * show submission votes in subs list and forum topics * add icon to claim button * only show "current" on wiki revisions that are actually current * show links to revision source on wiki page history * improve page history "from-to" colors, table colors were bad on dark mode * use button design for page footer * remove empty line for style * make the vote counts query robust against edited polls
- Loading branch information
1 parent
0a4861b
commit 59225ec
Showing
13 changed files
with
90 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace TASVideos.Common; | ||
|
||
public class VoteCounts | ||
{ | ||
public int VotesYes { get; init; } | ||
public int VotesMeh { get; init; } | ||
public int VotesNo { get; init; } | ||
public bool UserVotedYes { get; init; } | ||
public bool UserVotedMeh { get; init; } | ||
public bool UserVotedNo { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@model VoteCounts? | ||
|
||
<span condition="Model is not null"> | ||
@{ | ||
int totalCount = Model!.VotesYes + Model.VotesMeh + Model.VotesNo; | ||
if (totalCount == 0) | ||
{ | ||
<text>No votes</text> | ||
} | ||
else | ||
{ | ||
var support = Math.Ceiling(100 * ((Model.VotesYes + (Model.VotesMeh / 2d)) / totalCount)); | ||
<text>@support%</text> | ||
} | ||
|
||
if (totalCount != 0){ | ||
<text> (<span class="@(Model.UserVotedYes ? "fw-bold" : "")">@Model.VotesYes</span>/<span class="@(Model.UserVotedMeh ? "fw-bold" : "")">@Model.VotesMeh</span>/<span class="@(Model.UserVotedNo ? "fw-bold" : "")">@Model.VotesNo</span>)</text> | ||
} | ||
} | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,16 @@ | |
} | ||
|
||
@functions { | ||
string RowStyles(int revision) | ||
{ | ||
if (revision == Model.FromRevision) | ||
{ | ||
return "table-info"; | ||
} | ||
|
||
if (revision == Model.ToRevision) | ||
{ | ||
return "table-primary"; | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
string DiffBtnStyles(int revision, bool isFrom) | ||
{ | ||
if (isFrom && revision == Model.FromRevision) | ||
{ | ||
return "btn btn-info btn-sm active"; | ||
return "btn btn-info btn-sm bg-warning"; | ||
} | ||
|
||
if (!isFrom && revision == Model.ToRevision) | ||
{ | ||
return "btn btn-info btn-sm active"; | ||
return "btn btn-info btn-sm bg-warning"; | ||
} | ||
|
||
return "btn btn-info btn-sm"; | ||
|
@@ -55,8 +40,8 @@ | |
{ | ||
var revision = revisions[i]; | ||
var previousId = i < revisions.Count - 1 ? revisions[i + 1].Revision : (int?)null; | ||
<tr data-revision="@revision.Revision" class="@RowStyles(revision.Revision)"> | ||
<td><a href="/@(Model.PageName)[email protected]">@revision.Revision</a></td> | ||
<tr data-revision="@revision.Revision"> | ||
<td><a href="/@(Model.PageName)[email protected]">@revision.Revision</a> (<a asp-page="ViewSource" asp-route-path="@Model.Path" asp-route-revision="@revision.Revision">source</a>)</td> | ||
<td><timezone-convert asp-for="@revision.CreateTimestamp" /></td> | ||
<td><profile-link username="@revision.CreateUserName"></profile-link></td> | ||
<td>@revision.MinorEdit</td> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters