allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/5] git commit: [#4905] ticket:634 added new subscribe menu for all wiki pages
Date Tue, 16 Sep 2014 15:44:30 GMT
Repository: allura
Updated Branches:
  refs/heads/master fab7d22e4 -> ef66cbbdd


[#4905] ticket:634 added new subscribe menu for all wiki pages


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/36996286
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/36996286
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/36996286

Branch: refs/heads/master
Commit: 369962867b663fc17799c42381231c5851d95751
Parents: fab7d22
Author: discort <lexad-al@bk.ru>
Authored: Fri Aug 22 00:44:41 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Sep 16 15:33:35 2014 +0000

----------------------------------------------------------------------
 .../forgewiki/templates/wiki/page_view.html     |  3 ++-
 ForgeWiki/forgewiki/wiki_main.py                | 20 +++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/36996286/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index c076f57..61407c4 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -62,7 +62,8 @@
 
   {% endif %}
   {% if c.user and c.user != c.user.anonymous() %}
-    {{c.subscribe_form.display(value=subscribed, action='subscribe', style='icon')}}
+    {{c.subscribe_form.display(value=page_subscribed, tool_subscribed=tool_subscribed, action='subscribe',
style='icon')}}
+    {{c.wiki_subscribe_form.display(value=subscribed, action='wiki_subscribe', style='icon')}}
   {% endif %}
 	<a href="feed" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"
title="Feed"></b></a>
   <a href="../search" title="Search"><b data-icon="{{g.icons['search'].char}}" class="ico
{{g.icons['search'].css}}" title="Search"></b></a>

http://git-wip-us.apache.org/repos/asf/allura/blob/36996286/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 8c46f00..c6abf88 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -69,6 +69,7 @@ class W:
     attachment_list = ffw.AttachmentList()
     subscribe_form = SubscribeForm()
     page_subscribe_form = SubscribeForm(thing='page')
+    wiki_subscribe_form = SubscribeForm(thing='wiki')
     page_list = ffw.PageList()
     page_size = ffw.PageSize()
     search_results = SearchResults()
@@ -494,6 +495,7 @@ class PageController(BaseController, FeedController):
         c.thread = W.thread
         c.attachment_list = W.attachment_list
         c.subscribe_form = W.page_subscribe_form
+        c.wiki_subscribe_form = W.wiki_subscribe_form
         post_count = self.page.discussion_thread.post_count
         limit, pagenum = h.paging_sanitizer(limit, page, post_count)
         page = self.get_version(version)
@@ -511,10 +513,17 @@ class PageController(BaseController, FeedController):
             prev = None
         next = cur + 1
         hide_left_bar = not (c.app.show_left_bar)
+        tool_subscribed = M.Mailbox.subscribed()
+        if tool_subscribed:
+            subscribed = False
+        else:
+            subscribed = M.Mailbox.subscribed(artifact=self.page)
         return dict(
             page=page,
             cur=cur, prev=prev, next=next,
-            subscribed=M.Mailbox.subscribed(artifact=self.page),
+            tool_subscribed=tool_subscribed,
+            page_subscribed=subscribed,
+            subscribed=M.Mailbox.subscribed(),
             hide_left_bar=hide_left_bar, show_meta=c.app.show_right_bar,
             pagenum=pagenum, limit=limit, count=post_count)
 
@@ -701,6 +710,15 @@ class PageController(BaseController, FeedController):
             self.page.unsubscribe()
         redirect(request.referer)
 
+    @expose()
+    @validate(W.subscribe_form)
+    def wiki_subscribe(self, subscribe=None, unsubscribe=None):
+        if subscribe:
+            M.Mailbox.subscribe(type='direct')
+        elif unsubscribe:
+            M.Mailbox.unsubscribe()
+        redirect(request.referer)
+
 
 class WikiAttachmentController(ac.AttachmentController):
     AttachmentClass = WM.WikiAttachment


Mime
View raw message