ForumTopicActions to partial from macro

This commit is contained in:
Sebastiaan Janssen
2017-01-22 16:40:35 +01:00
parent 0598124f67
commit 35f6de1686
4 changed files with 41 additions and 52 deletions
+1 -1
View File
@@ -1697,7 +1697,6 @@
<Content Include="Assets\css\fonts\icomoon\icomoon.eot" />
<Content Include="Assets\css\fonts\icomoon\icomoon.ttf" />
<Content Include="Assets\css\fonts\icomoon\icomoon.woff" />
<Content Include="Views\MacroPartials\Forum\TopicActions.cshtml" />
<Content Include="Assets\js\jquery.scrolly.js" />
<Content Include="Views\MacroPartials\Members\Profile.cshtml" />
<Content Include="Views\MacroPartials\Members\ProfileNotifications.cshtml" />
@@ -4366,6 +4365,7 @@
<Content Include="Views\Partials\Navigation\TopNavigation.cshtml" />
<Content Include="Views\Partials\Global\Alertbar.cshtml" />
<Content Include="Views\Partials\Global\Breadcrumb.cshtml" />
<Content Include="Views\Partials\Forum\TopicActions.cshtml" />
<None Include="web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
+1 -1
View File
@@ -11,7 +11,7 @@
@Html.Action("Render", "Breadcrumb", new { linkToCurrent = true })
<!-- FORUM BREADCRUMB END -->
<!-- THREAD ACTIONS START -->
@Umbraco.RenderMacro("ForumTopicActions")
@Html.Partial("~/Views/Partials/Forum/TopicActions.cshtml")
<!-- THREAD ACTIONS END -->
<div class="clear"></div>
</div>
@@ -1,50 +0,0 @@
@using OurUmbraco.Forum.Extensions
@using OurUmbraco.Forum.Services
@using OurUmbraco.NotificationsWeb.Library
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var topicService = new TopicService(ApplicationContext.DatabaseContext);
var topic = topicService.CurrentTopic(this.Context, ApplicationContext.ApplicationCache.RequestCache);
}
<div class="utility-actions">
@if(topic != null)
{
if (Members.IsLoggedIn())
{
var mem = Members.GetCurrentMember();
var subscribed = false;
if (mem != null)
{
subscribed = Utils.IsSubscribedToForumTopic(topic.Id, mem.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>
}
}
</div>
@@ -0,0 +1,39 @@
@using OurUmbraco.Forum.Services
@using OurUmbraco.NotificationsWeb.Library
@inherits OurUmbraco.Our.Models.OurUmbracoTemplatePage
@{
var topicService = new TopicService(ApplicationContext.DatabaseContext);
var topic = topicService.CurrentTopic(Context, ApplicationContext.ApplicationCache.RequestCache);
}
<div class="utility-actions">
@if (topic != null)
{
if (MemberData != null)
{
var subscribed = false;
if (MemberData != null)
{
subscribed = Utils.IsSubscribedToForumTopic(topic.Id, MemberData.Member.Id);
}
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>