From 4dcef22ce72219aac08ccf859aafc94995ab01f5 Mon Sep 17 00:00:00 2001 From: rxtur Date: Sun, 7 Feb 2016 22:36:47 -0600 Subject: [PATCH] Pull widget title from the model --- BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs | 2 +- .../BlogEngine.NET/Custom/Widgets/Administration/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/AuthorList/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml | 2 +- .../BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml | 3 ++- .../BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml | 2 +- .../admin/app/custom/widgets/widgetController.js | 1 + 10 files changed, 11 insertions(+), 9 deletions(-) diff --git a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs index bb8746f8d..9bb64a4e9 100644 --- a/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs +++ b/BlogEngine/BlogEngine.NET/AppCode/Controls/WidgetZone.cs @@ -83,7 +83,7 @@ protected override void OnLoad(EventArgs e) widget.InnerText); try { - var model = new { Id = widget.Attributes["id"].Value, Title = widget.Attributes["title"].Value }; + var model = new { Id = widget.Attributes["id"].Value, Name = widget.InnerText, Title = widget.Attributes["title"].Value }; var lit = new Literal { Text = RazorHelpers.ParseRazor(fileName, model) }; Controls.Add(lit); } diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Administration/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Administration/widget.cshtml index adb4c5ad6..cf794a0f5 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Administration/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Administration/widget.cshtml @@ -1,6 +1,6 @@ @using BlogEngine.Core @{ - var title = "Administration"; + var title = Model.Title; var dashboardUrl = Utils.RelativeWebRoot + "admin/index.cshtml"; var contentUrl = Utils.RelativeWebRoot + "admin/#/content/posts"; var customUrl = Utils.RelativeWebRoot + "admin/#/custom/themes"; diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/AuthorList/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/AuthorList/widget.cshtml index d80c7eb0c..e56983393 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/AuthorList/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/AuthorList/widget.cshtml @@ -1,7 +1,7 @@ @using BlogEngine.Core @using BlogEngine.Core.Data.Services @{ - var title = "Author List"; + var title = Model.Title; var authorUrl = Utils.RelativeWebRoot + "author"; var authorRss = Utils.RelativeWebRoot + "syndication.axd"; diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml index 7562d4583..47774a849 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Blog List/widget.cshtml @@ -1,6 +1,6 @@ @using BlogEngine.Core @{ - var title = "Blog List"; + var title = Model.Title; var blogs = Blog.Blogs.Where(b => b.IsActive).ToList(); }
diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml index c5e5b6521..e82ec6919 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Category list/widget.cshtml @@ -1,6 +1,6 @@ @using BlogEngine.Core @{ - var title = "Category list"; + var title = Model.Title; var dic = BlogEngine.Core.Helpers.CategoryHelper.SortCategories(); }
diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml index 75f0dc2ad..cf49bbade 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Page List/widget.cshtml @@ -1,6 +1,6 @@ @using BlogEngine.Core @{ - var title = "Page List"; + var title = Model.Title; }

@title

diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml index 54327d206..4b9b763be 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Post List/widget.cshtml @@ -1,7 +1,7 @@ @using BlogEngine.Core.Helpers @using BlogEngine.Core @{ - var title = "Post List"; + var title = Model.Title; var id = Model.Id; var settings = WidgetHelper.GetSettings(id); diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml index 202d3bf8f..adbf19ff1 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/RecentComments/widget.cshtml @@ -2,6 +2,7 @@ @using BlogEngine.Core.Helpers @using System.Text.RegularExpressions @{ + var title = Model.Title; var numberOfComments = 10; var settings = WidgetHelper.GetSettings(Model.Id); if (settings != null && settings.Count > 0) @@ -24,7 +25,7 @@ }
-

Recent comments

+

@title

    @if (list.Count > 0) diff --git a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml b/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml index 5f0cb01ba..bae65a96f 100644 --- a/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml +++ b/BlogEngine/BlogEngine.NET/Custom/Widgets/Tag cloud/widget.cshtml @@ -1,5 +1,5 @@ @{ - var title = "Tag cloud"; + var title = Model.Title; var cloud = new BlogEngine.Core.Data.Services.TagCloud(); var tags = cloud.Links(); } diff --git a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js index 2192cb42f..21feeb257 100644 --- a/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js +++ b/BlogEngine/BlogEngine.NET/admin/app/custom/widgets/widgetController.js @@ -37,6 +37,7 @@ var customSrc = SiteVars.ApplicationRelativeWebRoot + "Custom/Widgets/" + name + "/edit.cshtml"; $scope.editId = id; $scope.editTitle = title; + $("#txtWidgetTitle").val(title); $.ajax({ type: 'HEAD', url: customSrc,