You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/10/19 13:37:37 UTC
[12/50] [abbrv] allura git commit: Fix JS issue with subscriptions.
Blog post subscribe action to say "post".
Fix JS issue with subscriptions. Blog post subscribe action to say "post".
Don't include subscriptions.js which needs react.js, when logged out. The
subscription widget only is meant for logged-in users. And the template
which includes react.js is only included when logged in already.
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/bcf93e11
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/bcf93e11
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/bcf93e11
Branch: refs/heads/ib/7924
Commit: bcf93e117a175c2fde54175df38defabee23fe2a
Parents: aa6e158
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Sep 28 17:52:00 2015 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Sep 28 17:52:00 2015 -0400
----------------------------------------------------------------------
Allura/allura/lib/widgets/subscriptions.py | 4 +++-
ForgeBlog/forgeblog/main.py | 2 +-
ForgeBlog/forgeblog/templates/blog/post.html | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/bcf93e11/Allura/allura/lib/widgets/subscriptions.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/subscriptions.py b/Allura/allura/lib/widgets/subscriptions.py
index c8d3dcd..4e3324a 100644
--- a/Allura/allura/lib/widgets/subscriptions.py
+++ b/Allura/allura/lib/widgets/subscriptions.py
@@ -17,6 +17,7 @@
import ew as ew_core
import ew.jinja2_ew as ew
+from pylons import tmpl_context as c
from allura.lib import validators as V
from allura.lib.widgets import form_fields as ffw
@@ -90,4 +91,5 @@ class SubscribeForm(ew.SimpleForm):
def resources(self):
for r in super(SubscribeForm, self).resources():
yield r
- yield ew.JSLink('js/subscriptions.js')
+ if not c.user.is_anonymous():
+ yield ew.JSLink('js/subscriptions.js')
http://git-wip-us.apache.org/repos/asf/allura/blob/bcf93e11/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index b4f4641..a3483cf 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -70,7 +70,7 @@ class W:
attachment_add = ffw.AttachmentAdd()
attachment_list = ffw.AttachmentList()
preview_post_form = widgets.PreviewPostForm()
- subscribe_form = SubscribeForm()
+ subscribe_form = SubscribeForm(thing='post')
search_results = SearchResults()
help_modal = SearchHelp()
http://git-wip-us.apache.org/repos/asf/allura/blob/bcf93e11/ForgeBlog/forgeblog/templates/blog/post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog/post.html b/ForgeBlog/forgeblog/templates/blog/post.html
index c0caad3..d0a3434 100644
--- a/ForgeBlog/forgeblog/templates/blog/post.html
+++ b/ForgeBlog/forgeblog/templates/blog/post.html
@@ -27,7 +27,9 @@
<a href="edit" title="Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}"></b></a>
{% endif %}
<a href="history" title="History"><b data-icon="{{g.icons['history'].char}}" class="ico {{g.icons['history'].css}}"></b></a>
- {{c.subscribe_form.display(value=subscribed, action='subscribe', style='icon')}}
+ {% if c.user and c.user != c.user.anonymous() %}
+ {{c.subscribe_form.display(value=subscribed, action='subscribe', style='icon')}}
+ {% endif %}
<a href="feed" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
{% endblock %}