category/forum following

This commit is contained in:
TimGeyssens
2015-02-12 13:42:43 +01:00
parent 2230864f92
commit fce60427e1
6 changed files with 49 additions and 19 deletions
@@ -7,12 +7,12 @@ namespace NotificationsWeb.Api
public class NotificationsController:UmbracoApiController
{
[HttpGet]
public string SubscribeToForumTopic(int topicId)
public string SubscribeToForumTopic(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
BusinessLogic.ForumTopic.Subscribe(topicId, currentMemberId);
BusinessLogic.ForumTopic.Subscribe(id, currentMemberId);
return "true";
}
@@ -21,12 +21,12 @@ namespace NotificationsWeb.Api
}
[HttpGet]
public string UnSubscribeFromForumTopic(int topicId)
public string UnSubscribeFromForumTopic(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
BusinessLogic.ForumTopic.UnSubscribe(topicId, currentMemberId);
BusinessLogic.ForumTopic.UnSubscribe(id, currentMemberId);
return "true";
}
@@ -35,12 +35,12 @@ namespace NotificationsWeb.Api
}
[HttpGet]
public string SubscribeToForum(int forumId)
public string SubscribeToForum(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
BusinessLogic.Forum.Subscribe(forumId, currentMemberId);
BusinessLogic.Forum.Subscribe(id, currentMemberId);
return "true";
}
@@ -49,12 +49,12 @@ namespace NotificationsWeb.Api
}
[HttpGet]
public string UnSubscribeFromForum(int forumId)
public string UnSubscribeFromForum(int id)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (currentMemberId > 0)
{
BusinessLogic.Forum.UnSubscribe(forumId, currentMemberId);
BusinessLogic.Forum.UnSubscribe(id, currentMemberId);
return "true";
}
+7 -6
View File
@@ -40,12 +40,12 @@
});
},
followThread: function (id) {
$.get("/umbraco/api/Notifications/SubscribeToForumTopic/?topicId=" + id);
follow: function (id,controller) {
$.get("/umbraco/api/Notifications/SubscribeToForum"+controller+"/?id=" + id);
},
unfollowThread: function (id) {
$.get("/umbraco/api/Notifications/UnSubscribeFromForumTopic/?topicId=" + id);
unfollow: function (id,controller) {
$.get("/umbraco/api/Notifications/UnSubscribeFromForum"+controller+"/?id=" + id);
},
markAsSpam: function (id,controller) {
@@ -197,15 +197,16 @@ $(function () {
e.preventDefault();
var data = $(this).data();
var id = parseInt(data.id);
var controller = data.controller;
if ($(this).hasClass("following")) {
community.unfollowThread(id);
community.unfollow(id,controller);
$(this).removeClass("following");
$("span", $(this)).text("Follow");
}
else
{
community.followThread(id);
community.follow(id,controller);
$(this).addClass("following");
$("span", $(this)).text("Following");
}
+1
View File
@@ -1797,6 +1797,7 @@
<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="Views\MacroPartials\Forum\ForumActions.cshtml" />
<None Include="Views\Partials\Forum\MemberBadge.cshtml" />
<Content Include="Views\Web.config" />
<Content Include="web.config">
@@ -0,0 +1,28 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
<a href="#" class="button create-new-thread" data-controller="topic">
<i class="icon-Add"></i><span>Create new</span>
</a>
@if (Members.IsLoggedIn())
{
var mem = Members.GetCurrentMember();
var subscribed = NotificationsWeb.Library.Utils.IsSubscribedToForum(CurrentPage.Id, mem.Id);
if (CurrentPage.Level == 4) {
if (subscribed)
{
<a href="#" class="follow button following" data-id="@CurrentPage.Id" data-controller="">
<i class="icon-Bookmark"></i><span>Following</span>
</a>
}
else
{
<a href="#" class="follow button transparent" data-id="@CurrentPage.Id" data-controller="">
<i class="icon-Bookmark"></i><span>Follow</span>
</a>
}
}
}
@@ -15,12 +15,12 @@
</a>
if (subscribed) {
<a href="#" class="follow button following" data-id="@topic.Id">
<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">
<a href="#" class="follow button transparent" data-id="@topic.Id" data-controller="topic">
<i class="icon-Bookmark"></i><span>Follow</span>
</a>
}
+3 -3
View File
@@ -9,10 +9,10 @@
<umbraco:Macro linkToCurrent="1" Alias="Breadcrumb" runat="server"></umbraco:Macro>
<!-- FORUM BREADCRUMB END -->
<umbraco:Macro Alias="[Forum]ForumActions" runat="server"></umbraco:Macro>
<a href="#" class="button create-new-thread" data-controller="topic">
<i class="icon-Add"></i><span>Create new</span>
</a>
</div>
<div class="clear"></div>
<!-- FORUM HEADER END -->