From 96779ebd85661ef775241c4e209b727642369dcc Mon Sep 17 00:00:00 2001 From: Marnix van Valen Date: Wed, 18 Nov 2020 23:28:38 +0100 Subject: [PATCH] Ratings --- Models/ContentTypes/Post.Generated.cs | 2 ++ Models/ContentTypes/Post.cs | 1 - input/Shared/postbox.cshtml | 2 +- input/Shared/star_rating.cshtml | 5 +++-- input/Shared/star_rating_postbox.cshtml | 10 ---------- 5 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 input/Shared/star_rating_postbox.cshtml diff --git a/Models/ContentTypes/Post.Generated.cs b/Models/ContentTypes/Post.Generated.cs index 8099f04..18416e6 100644 --- a/Models/ContentTypes/Post.Generated.cs +++ b/Models/ContentTypes/Post.Generated.cs @@ -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"; @@ -47,6 +48,7 @@ public partial class Post public IEnumerable MetadataTwitterImage { get; set; } public string MetadataTwitterSite { get; set; } public DateTime? PostDate { get; set; } + public decimal? Rating { get; set; } public IEnumerable Related { get; set; } public IEnumerable Settings { get; set; } public IContentItemSystemAttributes System { get; set; } diff --git a/Models/ContentTypes/Post.cs b/Models/ContentTypes/Post.cs index c4f835e..68463b2 100644 --- a/Models/ContentTypes/Post.cs +++ b/Models/ContentTypes/Post.cs @@ -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 } } \ No newline at end of file diff --git a/input/Shared/postbox.cshtml b/input/Shared/postbox.cshtml index 90d8787..b9147bb 100644 --- a/input/Shared/postbox.cshtml +++ b/input/Shared/postbox.cshtml @@ -19,7 +19,7 @@ @if (Model.Rating.HasValue) {
- @{ await Html.RenderPartialAsync("star_rating_postbox", Model);} +
}

@Model.MetadataMetaDescription.GetMaxWords(30)

diff --git a/input/Shared/star_rating.cshtml b/input/Shared/star_rating.cshtml index 89596fe..6ca43dc 100644 --- a/input/Shared/star_rating.cshtml +++ b/input/Shared/star_rating.cshtml @@ -1,6 +1,7 @@ -@model int +@using System.Globalization +@model decimal
-
+
diff --git a/input/Shared/star_rating_postbox.cshtml b/input/Shared/star_rating_postbox.cshtml deleted file mode 100644 index 3ad5b9b..0000000 --- a/input/Shared/star_rating_postbox.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -@model Kentico.Kontent.Statiq.Memoirs.Models.Post -
-
- - - - - -
-
\ No newline at end of file