Files
OurUmbraco/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml
T
2015-07-26 12:31:15 +02:00

85 lines
2.6 KiB
Plaintext

@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using System.Web.Mvc.Html
@using OurUmbraco.Forum.Services
@{
var topicService = new TopicService(ApplicationContext.DatabaseContext);
var topic = topicService.CurrentTopic(this.Context, ApplicationContext.ApplicationCache.RequestCache);
}
<!-- COPY LINK -->
<div id="overlay" class="overlay"></div>
<div id="copy-link-wrapper" class="copy-link-wrapper">
<i class="icon-Link"></i>
<textarea class="getLink" readonly type="text"></textarea>
<p>Press Ctrl / CMD + C to copy this to your clipboard.</p>
</div>
<div id="thankyou">
Copied to clipboard
</div>
<!-- COPY LINK END -->
<!-- DELETE THREAD/COMMENT START -->
@if (Members.IsLoggedIn())
{
<div id="confirm-wrapper" class="confirm-wrapper">
<h4>Are you sure?</h4>
<p>This <span class="type-of"></span> will be gone forever and ever</p>
<br />
<button type="button" class="button green tiny">Yes</button>
<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">
<h4>Flag this post as spam?</h4>
<p>This post will be reported to the moderators as potential spam to be looked at</p>
<br />
<button type="button" class="button green tiny">Yes</button>
<button type="button" class="button red tiny">No</button>
</div>
<!-- FLAG SPAM END -->
@if(topic != null)
{
<ul class="comments">
@Html.Partial("forum/question", topic)
@foreach (var comment in topic.Comments.Where(x => x.ParentCommentId == 0))
{
var comm = comment;
Html.RenderPartial("forum/comment", comm, new ViewDataDictionary { { "level", 1 }, { "answer", topic.Answer } });
if (comm.HasChildren)
{
var children = topic.Comments.Where(x => x.ParentCommentId == comm.Id);
foreach (var child in children.Where(c => c.ParentCommentId == comm.Id))
{
Html.RenderPartial("forum/comment", child, new ViewDataDictionary { { "level", 2 }, { "answer", topic.Answer } });
}
}
}
</ul>
if (Members.IsLoggedIn())
{
<div class="replybutton">
<a href="#" class="button green large reply forum-reply" data-author="@topic.AuthorName" data-topic="@topic.Id" data-controller="comment">Reply to topic</a>
</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>
}