Skip to content

Commit

Permalink
Added render optimization to ratingSpan. Updated alignment for 'R' bu…
Browse files Browse the repository at this point in the history
…tton.
  • Loading branch information
morrisonbrett committed Oct 10, 2024
1 parent 6631737 commit 19d82ea
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
7 changes: 6 additions & 1 deletion pickuphockey/Content/Site.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ textarea {
width: 24px;
height: 24px;
margin-top: 14px;
margin-left: 13px;
margin-bottom: 14px;
border-radius: 50%;
border: 2px;
Expand All @@ -75,4 +76,8 @@ textarea {
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
}
}

.rating-span {
display: none;
}
4 changes: 2 additions & 2 deletions pickuphockey/Scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
s += result[i].User.FirstName;
s += '<span> </span>';
s += result[i].User.LastName;
s += '<span id="ratingDisplay" display="none"><span> (</span>';
s += '<span id="ratingDisplay" class="rating-span"><span> (</span>';
s += result[i].User.Rating.toFixed(1);
s += '</span><span id="ratingDisplay" display="none">)</span><span>, </span>';
s += '</span><span id="ratingDisplay" class="rating-span">)</span><span>, </span>';
s += result[i].PositionPreference == 1 ? 'Forward' : 'Defense';
s += '<br />'

Expand Down
2 changes: 1 addition & 1 deletion pickuphockey/Views/Shared/_BuySellsPartial.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}
<tr>
<td>
@sellerName<span id="ratingDisplay" style="display:none">@sellerRating</span> @sellingVerb @buyerName<span id="ratingDisplay" style="display:none">@buyerRating</span>
@sellerName<span id="ratingDisplay" class="rating-span">@sellerRating</span> @sellingVerb @buyerName<span id="ratingDisplay" class="rating-span">@buyerRating</span>
</td>
<td>
@if (isAdmin)
Expand Down
20 changes: 10 additions & 10 deletions pickuphockey/Views/Shared/_RosterPartial.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
<div style="text-decoration: line-through;">
@Html.DisplayFor(modelItem => item.User.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.User.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>}</span><span>, </span>
Expand All @@ -29,7 +29,7 @@
else
{
@Html.DisplayFor(modelItem => item.User.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.User.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>}</span><span>, </span>
Expand All @@ -43,7 +43,7 @@
{
<div style="text-decoration: line-through;">
@Html.DisplayFor(modelItem => item.BuyerUser.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.BuyerUser.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>
Expand All @@ -53,7 +53,7 @@
else
{
@Html.DisplayFor(modelItem => item.BuyerUser.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.BuyerUser.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>
Expand All @@ -69,7 +69,7 @@
{
<div style="text-decoration: line-through;">
@Html.DisplayFor(modelItem => item.User.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.User.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>}</span><span>, </span>
Expand All @@ -79,7 +79,7 @@
else
{
@Html.DisplayFor(modelItem => item.User.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.User.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.User.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>}</span><span>, </span>
Expand All @@ -93,7 +93,7 @@
{
<div style="text-decoration: line-through;">
@Html.DisplayFor(modelItem => item.BuyerUser.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.BuyerUser.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>
Expand All @@ -103,7 +103,7 @@
else
{
@Html.DisplayFor(modelItem => item.BuyerUser.FirstName)<span> </span>
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" display="none">@if (isAdmin || isSubAdmin)
@Html.DisplayFor(modelItem => item.BuyerUser.LastName)<span id="ratingDisplay" class="rating-span">@if (isAdmin || isSubAdmin)
{
var rating = string.Format("{0:0.0}", item.BuyerUser.Rating);
<span> (</span>@Html.DisplayFor(modelItem => rating)<span>)</span>
Expand All @@ -116,10 +116,10 @@
@if (isAdmin || isSubAdmin)
{
<tr>
<th><span id="ratingDisplay" display="none">
<th><span id="ratingDisplay" class="rating-span">
Light Rating: Total: @string.Format("{0:0.0}", Model.LightTotalRating), Average: @string.Format("{0:0.00}", @Decimal.Divide(Model.LightTotalRating, Model.LightCount > 0 ? Model.LightCount : 1))
</span></th>
<th><span id="ratingDisplay" display="none">
<th><span id="ratingDisplay" class="rating-span">
Dark Rating: Total: @string.Format("{0:0.0}", Model.DarkTotalRating), Average: @string.Format("{0:0.00}", @Decimal.Divide(Model.DarkTotalRating, Model.DarkCount > 0 ? Model.DarkCount : 1))
</span></th>
</tr>
Expand Down

0 comments on commit 19d82ea

Please sign in to comment.