From 1cc123db0b5438616a24cbcd3baf1d46f2a9c155 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 19 Sep 2018 10:51:45 +0300 Subject: [PATCH] Blogging module: fixes --- .../Blogging/Posts/EfCorePostRepository.cs | 2 +- .../Resources/Blogging/Web/en.json | 6 +- .../Resources/Blogging/Web/tr.json | 1 + .../Pages/Blog/BloggingPage.cs | 2 +- .../Pages/Blog/Posts/Detail.cshtml | 23 +-- .../Pages/Blog/Posts/Index.cshtml | 133 +++++++++--------- 6 files changed, 79 insertions(+), 88 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index 7d1f07f5fb..a48682855c 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Blogging.Posts public List GetPostsByBlogId(Guid id) { - return DbSet.Where(p => p.BlogId == id).ToList(); + return DbSet.Where(p => p.BlogId == id).OrderByDescending(p=>p.CreationTime).ToList(); } public async Task GetPostByUrl(Guid blogId, string url) diff --git a/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json b/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json index a5359e56b0..c6535013a9 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json +++ b/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json @@ -18,17 +18,19 @@ "Content": "Content", "SeeAll": "See All", "PopularTags": "Popular Tags", - "Read": "{0} Read", + "ReadWithCount": "{0} Read", "LastPosts": "Last Posts", "LeaveComment": "Leave Comment", "TagsInThisArticle": "Tags in this article", "Posts": "Posts", "Edit": "Edit", + "BLOG": "BLOG", "CommentDeletionWarningMessage": "Comment will be deleted.", "PostDeletionWarningMessage": "Post will be deleted.", "BlogDeletionWarningMessage": "Blog will be deleted.", "AreYouSure": "Are you sure?", - "Comment": "{0} Comment", + "CommentWithCount": "{0} Comment", + "Comment": "Comment", "ShareOnTwitter": "Share On Twitter", "CoverImage": "Cover Image", "CreateANewPost": "Create A New Post", diff --git a/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json b/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json index e0eff5d995..315c7e49a7 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json +++ b/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/tr.json @@ -25,6 +25,7 @@ "TagsInThisArticle": "Makalenin Etiketleri", "Posts": "Yazılar", "Edit": "Düzenle", + "BLOG": "BLOG", "CommentDeletionWarningMessage": "Yorum silinecek.", "PostDeletionWarningMessage": "Yazı silinecek.", "BlogDeletionWarningMessage": "Blog silinecek.", diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs index 29b416d26a..90395d763a 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs @@ -102,7 +102,7 @@ namespace Volo.Blogging.Pages.Blog } if (diffInSeconds >= 60) { - return L["MinutesAgo", diffInSeconds]; + return L["MinutesAgo", diffInSeconds / 60]; } if (diffInSeconds >= 1) { diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml index fb33f25e07..38d8fb93f7 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml @@ -27,29 +27,12 @@ @@ -176,81 +176,86 @@
-
-
-

@L["LastPosts"]

-
-
- @for (var index = 3; index < Model.Posts.Count; index++) - { - var post = Model.Posts[index]; - var oddPost = index % 2 == 1; + @if (Model.Posts.Count > 3) + { +
+
+

@L["LastPosts"]

+
+
+ @for (var index = 3; index < Model.Posts.Count; index++) + { + var post = Model.Posts[index]; + var oddPost = index % 2 == 1; -
-
-
-
- - - +
+
+
+
+ + + +
-
-
-

- @foreach (var tag in post.Tags) - { - @tag.Name - } -

-

- @post.Title -

-

- @(GetShortContent(post.Content)) -

-
- -
- } -
-
- -
-
-

@L["PopularTags"]

+ } +
- + }