From 2285a0ab76fc16afa28d1fe6952a64880217023d Mon Sep 17 00:00:00 2001 From: Joost Cassee Date: Mon, 27 Feb 2012 01:29:57 +0100 Subject: [PATCH] Fix several small UserVoice bugs --- analytical/templatetags/analytical.py | 1 + analytical/templatetags/uservoice.py | 7 +++---- analytical/tests/test_tag_uservoice.py | 8 ++++---- docs/services/uservoice.rst | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/analytical/templatetags/analytical.py b/analytical/templatetags/analytical.py index 4043219..37bc6ae 100644 --- a/analytical/templatetags/analytical.py +++ b/analytical/templatetags/analytical.py @@ -31,6 +31,7 @@ TAG_MODULES = [ 'analytical.reinvigorate', 'analytical.snapengage', 'analytical.spring_metrics', + 'analytical.uservoice', 'analytical.woopra', ] diff --git a/analytical/templatetags/uservoice.py b/analytical/templatetags/uservoice.py index 0e38e0d..0b0cb28 100644 --- a/analytical/templatetags/uservoice.py +++ b/analytical/templatetags/uservoice.py @@ -67,12 +67,11 @@ class UserVoiceNode(Node): @register.tag -def uservoice_link(parser, token): +def uservoice_popup(parser, token): """ - UserVoice link template tag. + UserVoice widget popup template tag. - Renders the Javascript link to launch the UserVoice widget. For - example:: + Renders the Javascript code to pop-up the UserVoice widget. For example:: Feedback diff --git a/analytical/tests/test_tag_uservoice.py b/analytical/tests/test_tag_uservoice.py index e62c35c..e5dc46c 100644 --- a/analytical/tests/test_tag_uservoice.py +++ b/analytical/tests/test_tag_uservoice.py @@ -55,18 +55,18 @@ class UserVoiceTagTestCase(TagTestCase): r) def test_link(self): - r = self.render_tag('uservoice', 'uservoice_link') + r = self.render_tag('uservoice', 'uservoice_popup') self.assertEqual(r, "UserVoice.showPopupWidget();") def test_link_with_key(self): r = self.render_tag('uservoice', - 'uservoice_link "efghijklmnopqrstuvwx"') + 'uservoice_popup "efghijklmnopqrstuvwx"') self.assertEqual(r, 'UserVoice.showPopupWidget({"widget_key": ' '"efghijklmnopqrstuvwx"});') def test_link_disables_tab(self): r = self.render_template( - '{% load uservoice %}{% uservoice_link %}{% uservoice %}') + '{% load uservoice %}{% uservoice_popup %}{% uservoice %}') self.assertTrue("UserVoice.showPopupWidget();" in r, r) self.assertTrue('"enabled": false' in r, r) self.assertTrue("'widget.uservoice.com/abcdefghijklmnopqrst.js'" in r, @@ -74,7 +74,7 @@ class UserVoiceTagTestCase(TagTestCase): def test_link_with_key_enables_tab(self): r = self.render_template('{% load uservoice %}' - '{% uservoice_link "efghijklmnopqrstuvwx" %}{% uservoice %}') + '{% uservoice_popup "efghijklmnopqrstuvwx" %}{% uservoice %}') self.assertTrue('UserVoice.showPopupWidget({"widget_key": ' '"efghijklmnopqrstuvwx"});' in r, r) self.assertTrue('"enabled": true' in r, r) diff --git a/docs/services/uservoice.rst b/docs/services/uservoice.rst index d2adf9f..ee9fdd6 100644 --- a/docs/services/uservoice.rst +++ b/docs/services/uservoice.rst @@ -86,7 +86,7 @@ to work. Per-view widget ............... -Iou can set the widget key in a view using the ``uservoice_widget_key`` +The widget key can by set in a view using the ``uservoice_widget_key`` template context variable:: context = RequestContext({'uservoice_widget_key': 'XXXXXXXXXXXXXXXXXXXX'}) @@ -129,10 +129,10 @@ the Javascript code to launch the widget:: If you use this tag and the :ttag:`uservoice` tag appears below it in the HTML, the default tab is automatically hidden. (The preferred location of the :ttag:`uservoice` is the bottom of the body HTML, so -this usually works automatically. See :ref:`uservoice-installation`.) +this usually works automatically.) You can explicitly hide the feedback tab by setting the -``uservoice_show_tab`` context variable to :const:``False``:: +``uservoice_show_tab`` context variable to :const:`False`:: context = RequestContext({'uservoice_show_tab': False}) return some_template.render(context)