From b35c2a4b493fa075a0f37c1877e794cf488deaec Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 22 Jan 2017 16:54:25 +0100 Subject: [PATCH] Move Thread and TopicForm to Partials instead of Macros --- OurUmbraco.Site/OurUmbraco.Site.csproj | 4 +- OurUmbraco.Site/Views/DisplayTopic.cshtml | 4 +- .../Forum/Thread.cshtml | 126 ++++++++---------- .../Forum/TopicForm.cshtml | 10 +- OurUmbraco/Forum/Services/TopicService.cs | 1 + 5 files changed, 64 insertions(+), 81 deletions(-) rename OurUmbraco.Site/Views/{MacroPartials => Partials}/Forum/Thread.cshtml (53%) rename OurUmbraco.Site/Views/{MacroPartials => Partials}/Forum/TopicForm.cshtml (98%) diff --git a/OurUmbraco.Site/OurUmbraco.Site.csproj b/OurUmbraco.Site/OurUmbraco.Site.csproj index 680887c1..ca47cfdb 100644 --- a/OurUmbraco.Site/OurUmbraco.Site.csproj +++ b/OurUmbraco.Site/OurUmbraco.Site.csproj @@ -1685,7 +1685,6 @@ - @@ -4321,7 +4320,6 @@ - @@ -4366,6 +4364,8 @@ + + web.config diff --git a/OurUmbraco.Site/Views/DisplayTopic.cshtml b/OurUmbraco.Site/Views/DisplayTopic.cshtml index 539ce909..ffa2ff79 100644 --- a/OurUmbraco.Site/Views/DisplayTopic.cshtml +++ b/OurUmbraco.Site/Views/DisplayTopic.cshtml @@ -16,7 +16,7 @@
- @Umbraco.RenderMacro("ForumThread") + @Html.Partial("~/Views/Partials/Forum/Thread.cshtml") -@Umbraco.RenderMacro("ForumForm") \ No newline at end of file +@Html.Partial("~/Views/Partials/Forum/TopicForm.cshtml") \ No newline at end of file diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml b/OurUmbraco.Site/Views/Partials/Forum/Thread.cshtml similarity index 53% rename from OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml rename to OurUmbraco.Site/Views/Partials/Forum/Thread.cshtml index 9871b060..df5f06bf 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml +++ b/OurUmbraco.Site/Views/Partials/Forum/Thread.cshtml @@ -1,4 +1,4 @@ -@inherits Umbraco.Web.Macros.PartialViewMacroPage +@inherits OurUmbraco.Our.Models.OurUmbracoTemplatePage @using System.Web.Mvc.Html @using OurUmbraco.Forum.Extensions @using OurUmbraco.Forum.Services @@ -7,7 +7,7 @@ @{ var topicService = new TopicService(ApplicationContext.DatabaseContext); - var topic = topicService.CurrentTopic(this.Context, ApplicationContext.ApplicationCache.RequestCache); + var topic = topicService.CurrentTopic(Context, ApplicationContext.ApplicationCache.RequestCache); var notification = Model.Content.GetPropertyValue("mainNotification"); if (string.IsNullOrWhiteSpace(notification)) @@ -32,7 +32,7 @@ -@if (Members.IsLoggedIn()) +@if (MemberData != null) {

Are you sure?

@@ -42,6 +42,7 @@
} +
@@ -62,7 +63,7 @@ }
    - + @{ try { @@ -92,75 +93,62 @@ }
- if (Members.IsLoggedIn()) - { - if (Model.Content.NewTopicsAllowed()) - { - - -
-
+ if (MemberData != null) + { + if (Model.Content.NewTopicsAllowed()) + { + - @if (Members.IsLoggedIn()) - { - var mem = Members.GetCurrentMember(); - var subscribed = false; - if (mem != null) - { - subscribed = Utils.IsSubscribedToForumTopic(topic.Id, mem.Id); - } +
+
+ @{ + var subscribed = false; + if (MemberData.Member != null) + { + subscribed = Utils.IsSubscribedToForumTopic(topic.Id, MemberData.Member.Id); + } - if (Members.IsAdmin()) - { - - Delete thread - - } - - if (subscribed) - { - - } - else - { - - } - } - - @if (topic.Answer > 0) - { - - Go to solution - - } + if (MemberData.IsAdmin) + { + + Delete thread + + } + + + if (topic.Answer > 0) + { + + Go to solution + + } + } +
+
+ } + else + { +
+ @Html.Raw(notification) +
+ } + } + else + { +
+ Please Sign in or register to post replies
-
- } - else - { -
- @Html.Raw(notification) -
- } - } - else - { -
- Please Sign in or register to post replies -
- } -} -else -{ -

This topic no longer exists.

-} + } + } + else + { +

This topic no longer exists.

+ } diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/TopicForm.cshtml b/OurUmbraco.Site/Views/Partials/Forum/TopicForm.cshtml similarity index 98% rename from OurUmbraco.Site/Views/MacroPartials/Forum/TopicForm.cshtml rename to OurUmbraco.Site/Views/Partials/Forum/TopicForm.cshtml index a3bd4399..73e617e7 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/TopicForm.cshtml +++ b/OurUmbraco.Site/Views/Partials/Forum/TopicForm.cshtml @@ -1,5 +1,5 @@ @using OurUmbraco.Forum.Extensions -@inherits Umbraco.Web.Macros.PartialViewMacroPage +@inherits OurUmbraco.Our.Models.OurUmbracoTemplatePage
@@ -101,11 +101,9 @@
- -