From 9540f4ec5358d36a102549581fdb4aab7e61bc59 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 18 Sep 2018 10:41:37 +0300 Subject: [PATCH] blogging module improvements --- .../Resources/Blogging/Web/en.json | 2 + .../Resources/Blogging/Web/tr.json | 2 + .../Pages/Admin/Blogs/index.js | 2 - .../Pages/Blog/Posts/Detail.cshtml | 49 ++++++++++++++----- .../Pages/Blog/Posts/Detail.cshtml.cs | 19 ++++--- .../Pages/Blog/Posts/Index.cshtml | 11 ----- 6 files changed, 49 insertions(+), 36 deletions(-) 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 2fdf8b127c..a5359e56b0 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 @@ -4,6 +4,8 @@ "Menu:Blogs": "Blog", "Menu:BlogManagement": "Blog Management", "Title": "Title", + "Delete": "Delete", + "Reply": "Reply", "ContinueReading": "Continue Reading", "DaysAgo": "{0} days ago", "YearsAgo": "{0} years ago", 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 5eeb05f327..e0eff5d995 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 @@ -3,6 +3,8 @@ "texts": { "Menu:Blogs": "Blog", "Title": "Başlık", + "Delete": "Sil", + "Reply": "Yanıtla", "Menu:BlogManagement": "Blog Yönetimi", "ContinueReading": "Devamı...", "DaysAgo": "{0} Gün Önce", diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js index 6fa5105c70..a7604b9d41 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js @@ -10,13 +10,11 @@ paging: true, searching: false, autoWidth: false, - scrollX: true, scrollCollapse: true, order: [[3, "desc"]], ajax: abp.libs.datatables.createAjax(volo.blogging.blogs.getListPaged), columnDefs: [ { - targets: 0, //optional rowAction: { items: [ 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 1f1f521d10..fb33f25e07 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 @@ -55,18 +55,41 @@ @L["Blog"] - | - - - - | - - - - | - - - + @if (!string.IsNullOrWhiteSpace(Model.Blog.Facebook)) + { + | + + + + } + @if (!string.IsNullOrWhiteSpace(Model.Blog.Twitter)) + { + | + + + + } + @if (!string.IsNullOrWhiteSpace(Model.Blog.Instagram)) + { + | + + + + } + @if (!string.IsNullOrWhiteSpace(Model.Blog.Github)) + { + | + + + + } + @if (!string.IsNullOrWhiteSpace(Model.Blog.StackOverflow)) + { + | + + + + } @@ -150,7 +173,7 @@ + href="@Model.GetTwitterShareUrl(Model.Post.Title, HttpContext.Request.GetEncodedUrl(), "@" + (Model.Blog.Twitter??""))" target="_blank"> @L["ShareOnTwitter"] diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs index 6f76fc4342..7e02cd8d3a 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs @@ -60,7 +60,7 @@ namespace Volo.Blogging.Pages.Blog.Posts await GetData(); } - + private async Task GetData() { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); @@ -78,20 +78,19 @@ namespace Volo.Blogging.Pages.Blog.Posts } } - public string GetTwitterShareUrl(string title, string url) + public string GetTwitterShareUrl(string title, string url, string linkedAccounts) { var readAtString = " | Read More At "; - var linkedAccounts = "" ; - - var otherCharsLength = (readAtString + linkedAccounts).Length; + var otherCharsLength = (readAtString + linkedAccounts).Length + 1; var maxTitleLength = 280 - TwitterLinkLength - otherCharsLength; + title = title.Length < maxTitleLength ? title : title.Substring(0, maxTitleLength - 3) + "..."; - title = title.Length < maxTitleLength ? title : title.Substring(0, maxTitleLength -3) + "..."; - - var text = title + readAtString + url + linkedAccounts; + var text = title + + readAtString + + url + + " " + linkedAccounts; - var builder = new UriBuilder("https://twitter.com/intent/tweet") { Query = "text=" + HttpUtility.UrlEncode(text) }; - return builder.ToString(); + return (new UriBuilder("https://twitter.com/intent/tweet") { Query = "text=" + HttpUtility.UrlEncode(text) }).ToString(); } public class PostDetailsViewModel diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml index d0b6e388fd..b8f915f6ab 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml @@ -250,17 +250,6 @@ - -