Move Thread and TopicForm to Partials instead of Macros

This commit is contained in:
Sebastiaan Janssen
2017-01-22 16:54:25 +01:00
parent 35f6de1686
commit b35c2a4b49
5 changed files with 64 additions and 81 deletions
+2 -2
View File
@@ -1685,7 +1685,6 @@
<Content Include="Views\ContentLanding.cshtml" />
<Content Include="Views\Blank.cshtml" />
<Content Include="Views\DisplayTopic.cshtml" />
<Content Include="Views\MacroPartials\Forum\TopicForm.cshtml" />
<Content Include="Views\MacroPartials\Members\HeaderProfile.cshtml" />
<Content Include="Views\Partials\Forum\Comment.cshtml" />
<Content Include="Assets\css\fonts\our-icon\our-umbraco.eot" />
@@ -4321,7 +4320,6 @@
<Content Include="umbraco\webservices\UltimatePickerAutoCompleteHandler.ashx" />
<Content Include="umbraco\xslt\Web.config" />
<Content Include="Views\MacroPartials\Forum\Latest.cshtml" />
<Content Include="Views\MacroPartials\Forum\Thread.cshtml" />
<Content Include="Views\Partials\Forum\Question.cshtml" />
<Content Include="Views\Partials\Members\Profile.cshtml" />
<Content Include="Views\Partials\Members\ProfileNotification.cshtml" />
@@ -4366,6 +4364,8 @@
<Content Include="Views\Partials\Global\Alertbar.cshtml" />
<Content Include="Views\Partials\Global\Breadcrumb.cshtml" />
<Content Include="Views\Partials\Forum\TopicActions.cshtml" />
<Content Include="Views\Partials\Forum\TopicForm.cshtml" />
<Content Include="Views\Partials\Forum\Thread.cshtml" />
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
+2 -2
View File
@@ -16,7 +16,7 @@
<div class="clear"></div>
</div>
<!-- FORUM HEADER END -->
@Umbraco.RenderMacro("ForumThread")
@Html.Partial("~/Views/Partials/Forum/Thread.cshtml")
</div>
</section>
@Umbraco.RenderMacro("ForumForm")
@Html.Partial("~/Views/Partials/Forum/TopicForm.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<string>("mainNotification");
if (string.IsNullOrWhiteSpace(notification))
@@ -32,7 +32,7 @@
<!-- COPY LINK END -->
<!-- DELETE THREAD/COMMENT START -->
@if (Members.IsLoggedIn())
@if (MemberData != null)
{
<div id="confirm-wrapper" class="confirm-wrapper">
<h4>Are you sure?</h4>
@@ -42,6 +42,7 @@
<button type="button" class="button red tiny">No</button>
</div>
}
<!-- DELETE THREAD END -->
<!-- FLAG SPAM START -->
<div id="confirm-wrapper-flag" class="confirm-wrapper-flag">
@@ -62,7 +63,7 @@
}
<ul class="comments">
@{
try
{
@@ -92,75 +93,62 @@
}
</ul>
if (Members.IsLoggedIn())
{
if (Model.Content.NewTopicsAllowed())
{
<div class="replybutton">
<a href="#" class="button green large reply forum-reply" data-author="@topic.AuthorName" data-topic="@topic.Id" data-controller="comment"><i class="icon-Reply-arrow"></i>&nbsp;Reply to topic</a>
</div>
<div class="utilities">
<div class="utility-actions thread-bottom">
if (MemberData != null)
{
if (Model.Content.NewTopicsAllowed())
{
<div class="replybutton">
<a href="#" class="button green large reply forum-reply" data-author="@topic.AuthorName" data-topic="@topic.Id" data-controller="comment"><i class="icon-Reply-arrow"></i>&nbsp;Reply to topic</a>
</div>
@if (Members.IsLoggedIn())
{
var mem = Members.GetCurrentMember();
var subscribed = false;
if (mem != null)
{
subscribed = Utils.IsSubscribedToForumTopic(topic.Id, mem.Id);
}
<div class="utilities">
<div class="utility-actions thread-bottom">
@{
var subscribed = false;
if (MemberData.Member != null)
{
subscribed = Utils.IsSubscribedToForumTopic(topic.Id, MemberData.Member.Id);
}
if (Members.IsAdmin())
{
<a href="#" class="delete-thread button" data-id="@topic.Id">
<i class="icon-Delete-key"></i><span>Delete thread</span>
</a>
}
if (subscribed)
{
<a href="#" class="follow button following" data-id="@topic.Id" data-controller="topic">
<i class="icon-Bookmark"></i><span>Following</span>
</a>
}
else
{
<a href="#" class="follow button transparent" data-id="@topic.Id" data-controller="topic">
<i class="icon-Bookmark"></i><span>Follow</span>
</a>
}
}
@if (topic.Answer > 0)
{
<a href="#comment-@topic.Answer.ToString()" class="go-to-solution button transparent">
<i class="icon-Check"></i><span>Go to solution</span>
</a>
}
if (MemberData.IsAdmin)
{
<a href="#" class="delete-thread button" data-id="@topic.Id">
<i class="icon-Delete-key"></i><span>Delete thread</span>
</a>
}
<a href="#" class="follow button @(subscribed ? "following" : "transparent")" data-id="@topic.Id" data-controller="topic">
<i class="icon-Bookmark"></i><span>@(subscribed ? "Following" : "Follow")</span>
</a>
if (topic.Answer > 0)
{
<a href="#comment-@topic.Answer.ToString()" class="go-to-solution button transparent">
<i class="icon-Check"></i><span>Go to solution</span>
</a>
}
}
</div>
</div>
}
else
{
<div class="alertbar__yellow">
@Html.Raw(notification)
</div>
}
}
else
{
<div class="replybutton notloggedin">
Please <a href="/member/login?redirectUrl=@(Server.UrlEncode(Request.Url.AbsoluteUri))">Sign in</a> or <a href="/member/signup">register</a> to post replies
</div>
</div>
}
else
{
<div class="alertbar__yellow">
@Html.Raw(notification)
</div>
}
}
else
{
<div class="replybutton notloggedin">
Please <a href="/member/login?redirectUrl=@(Server.UrlEncode(Request.Url.AbsoluteUri))">Sign in</a> or <a href="/member/signup">register</a> to post replies
</div>
}
}
else
{
<p>This topic no longer exists.</p>
}
}
}
else
{
<p>This topic no longer exists.</p>
}
<link rel="stylesheet" type="text/css" href="/css/tooltipster.css" />
<script type="text/javascript" src="/scripts/jquery.tooltipster.min.js"></script>
@@ -1,5 +1,5 @@
@using OurUmbraco.Forum.Extensions
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@inherits OurUmbraco.Our.Models.OurUmbracoTemplatePage
<div class="markdown-spacer"></div>
<div id="markdown-editor" class="markdown-editor">
@@ -101,11 +101,9 @@
</div>
<!-- Mustache template-->
<script id="comment-template" type="x-tmpl-mustache">
<li class="comment {{cssClass}}" data-parent="{{id}}" id="comment-{{id}}">
<li class="comment {{cssClass}}" data-parent="{{id}}" id="comment-{{id}}">
<div class="meta">
<div class="profile">
<a href="/member/{{authorId}}">{{authorName}}</a> has in total {{authorKarma}} karma points
@@ -123,14 +121,11 @@
</div>
<div class="comment-inner">
<a href="/member/{{authorId}}" class="photo">
{{{avatar}}}
</a>
<div class="highfive">
<div class="highfive-count">
0
</div>
@@ -146,7 +141,6 @@
</div>
{{/isSpam}}
{{{body}}}
</div>
</div>
@@ -4,6 +4,7 @@ using System.Linq;
using System.Web;
using OurUmbraco.Forum.Extensions;
using OurUmbraco.Forum.Models;
using OurUmbraco.Our.Models;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Persistence;