Skip to content

Commit

Permalink
Ratings
Browse files Browse the repository at this point in the history
  • Loading branch information
alanta committed Nov 18, 2020
1 parent 81f9214 commit 96779eb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Models/ContentTypes/Post.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class Post
public const string MetadataTwitterImageCodename = "metadata__twitter_image";
public const string MetadataTwitterSiteCodename = "metadata__twitter_site";
public const string PostDateCodename = "post_date";
public const string RatingCodename = "rating";
public const string RelatedCodename = "related";
public const string SettingsCodename = "settings";
public const string TagsCodename = "tags";
Expand All @@ -47,6 +48,7 @@ public partial class Post
public IEnumerable<IAsset> MetadataTwitterImage { get; set; }
public string MetadataTwitterSite { get; set; }
public DateTime? PostDate { get; set; }
public decimal? Rating { get; set; }
public IEnumerable<object> Related { get; set; }
public IEnumerable<IMultipleChoiceOption> Settings { get; set; }
public IContentItemSystemAttributes System { get; set; }
Expand Down
1 change: 0 additions & 1 deletion Models/ContentTypes/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ public partial class Post: IPageMetadata
{
public string Url => $"post/{PostDate.Value.Year}/{PostDate.Value.Month:00}/{UrlSlug}.html";

public int? Rating = null; // TODO : ratings
}
}
2 changes: 1 addition & 1 deletion input/Shared/postbox.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@if (Model.Rating.HasValue)
{
<div class="mb-2 mt-2 font-weight-normal">
@{ await Html.RenderPartialAsync("star_rating_postbox", Model);}
<partial name="star_rating" model="Model.Rating"/>
</div>}
</h2>
<h4 class="card-text">@Model.MetadataMetaDescription.GetMaxWords(30)</h4>
Expand Down
5 changes: 3 additions & 2 deletions input/Shared/star_rating.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@model int
@using System.Globalization
@model decimal
<div class="rating-holder">
<div class="c-rating c-rating--regular" data-rating-value="@Model">
<div class="c-rating c-rating--regular" data-rating-value="@Model.ToString("F1", CultureInfo.InvariantCulture)">
<button>1</button>
<button>2</button>
<button>3</button>
Expand Down
10 changes: 0 additions & 10 deletions input/Shared/star_rating_postbox.cshtml

This file was deleted.

0 comments on commit 96779eb

Please sign in to comment.