Fix several small UserVoice bugs

This commit is contained in:
Joost Cassee 2012-02-27 01:29:57 +01:00
parent fb98371a01
commit 2285a0ab76
4 changed files with 11 additions and 11 deletions

View file

@ -31,6 +31,7 @@ TAG_MODULES = [
'analytical.reinvigorate',
'analytical.snapengage',
'analytical.spring_metrics',
'analytical.uservoice',
'analytical.woopra',
]

View file

@ -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::
<a href="#" onclick="{% uservoice_popup %}; return false;">Feedback</a>

View file

@ -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)

View file

@ -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)