allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [27/28] git commit: [#4905] ticket:655 Move 'subscribe to wiki' button to sidebar
Date Fri, 12 Sep 2014 10:29:41 GMT
[#4905] ticket:655 Move 'subscribe to wiki' button to sidebar


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

Branch: refs/heads/je/42cc_4905
Commit: 4cd61a40161f421332a1a1f31e44bf93cac5e161
Parents: 4c45eb2
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Sep 12 09:53:05 2014 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Fri Sep 12 09:53:05 2014 +0300

----------------------------------------------------------------------
 .../forgewiki/templates/wiki/page_view.html     |  1 -
 ForgeWiki/forgewiki/wiki_main.py                | 34 +++++++++++---------
 2 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4cd61a40/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 4e19b2f..2f4d95f 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -63,7 +63,6 @@
   {% endif %}
   {% if c.user and c.user != c.user.anonymous() %}
     {{c.subscribe_form.display(value=page_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/4cd61a40/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 41f056e..f0169a4 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -69,7 +69,6 @@ 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()
@@ -228,6 +227,14 @@ The wiki uses [Markdown](%s) syntax.
                 SitemapEntry(
                     'Moderate', discussion.url() + 'moderate', ui_icon=g.icons['pencil'],
                     small=pending_mod_count))
+        subscribed = M.Mailbox.subscribed()
+        subscribe_action = 'unsubscribe' if subscribed else 'subscribe'
+        subscribe_title = '{}{}'.format(
+            subscribe_action.capitalize(),
+            '' if subscribed else ' to wiki')
+        subscribe_url = '{}subscribe?{}=True'.format(self.url, subscribe_action)
+        links += [SitemapEntry(''),
+                  SitemapEntry(subscribe_title, subscribe_url, ui_icon=g.icons['mail'])]
         if not admin_menu:
             links += [SitemapEntry(''),
                       SitemapEntry('Formatting Help', self.url + 'markdown_syntax/')]
@@ -439,6 +446,15 @@ class RootController(BaseController, DispatchIndex, FeedController):
         'Display a page about how to use markdown.'
         return dict(example=MARKDOWN_EXAMPLE)
 
+    @expose()
+    @validate(W.subscribe_form)
+    def subscribe(self, subscribe=None, unsubscribe=None):
+        if subscribe:
+            M.Mailbox.subscribe(type='direct')
+        elif unsubscribe:
+            M.Mailbox.unsubscribe()
+        redirect(request.referer)
+
 
 class PageController(BaseController, FeedController):
 
@@ -495,7 +511,6 @@ 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)
@@ -513,15 +528,11 @@ class PageController(BaseController, FeedController):
             prev = None
         next = cur + 1
         hide_left_bar = not (c.app.show_left_bar)
-        subscribed = M.Mailbox.subscribed()
-        subscribed_to_page = False
-        if not subscribed:
-            subscribed_to_page = M.Mailbox.subscribed(artifact=self.page)
+        subscribed_to_page = M.Mailbox.subscribed(artifact=self.page)
         return dict(
             page=page,
             cur=cur, prev=prev, next=next,
             page_subscribed=subscribed_to_page,
-            subscribed=subscribed,
             hide_left_bar=hide_left_bar, show_meta=c.app.show_right_bar,
             pagenum=pagenum, limit=limit, count=post_count)
 
@@ -708,15 +719,6 @@ 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