@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>