update docs

This commit is contained in:
Martín Gaitán 2013-11-26 12:44:05 -03:00
parent 63020a2062
commit d24802b358

View file

@ -63,12 +63,12 @@ alphanumerical string contained in the URL of the script imported by the
embed code::
<script type="text/javascript">
var uvOptions = {};
(function() {
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/XXXXXXXXXXXXXXXXXXXX.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
})();
UserVoice=window.UserVoice||[];(function(){
var uv=document.createElement('script');uv.type='text/javascript';
uv.async=true;uv.src='//widget.uservoice.com/XXXXXXXXXXXXXXXXXXXX.js';
var s=document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(uv,s)})();
</script>
(The widget key is shown as ``XXXXXXXXXXXXXXXXXXXX``.)
@ -87,17 +87,37 @@ is useful if you want to set a widget using a template context variable,
as the setting must be present for the generic :ttag:`analytical.*` tags
to work.
Widget options
..............
You can set :const:`USERVOICE_WIDGET_OPTIONS` to customize your widget
with UserVoice's options.
.. tip::
See the `JS SDK Overview <https://developer.uservoice.com/docs/widgets/overview/>`_ and the `reference <https://developer.uservoice.com/docs/widgets/options/>`_ for the details of available options.
For example, to override the default position of the widget, you could define:
.. code-block:: python
USERVOICE_WIDGET_OPTIONS = (('addTrigger',
{"trigger_position": "bottom-left",
"mode": "contact"}),)
Per-view widget
...............
The widget key can by set in a view using the ``uservoice_widget_key``
template context variable::
The widget key can be set in a view using the ``uservoice_widget_key`` and
``uservoice_widget_options`` template context variables::
context = RequestContext({'uservoice_widget_key': 'XXXXXXXXXXXXXXXXXXXX'})
return some_template.render(context)
The widget key passed in the context variable overrides the default
widget key.
These variable passed in the context overrides the default
widget configuration.
Setting the widget key in a context processor
.............................................
@ -118,79 +138,9 @@ The widget key passed in the context variable overrides both the default
and the per-view widget key.
.. _uservoice-link:
Using a custom link
-------------------
Instead of showing the default feedback tab, you can make the UserVoice
widget launch when a visitor clicks a link or when some other event
occurs. Use the :ttag:`uservoice_popup` tag in your template to render
the Javascript code to launch the widget::
<a href="#" onclick="{% uservoice_popup %}; return false;">Feedback</a>
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.)
You can explicitly hide the feedback tab by setting the
``uservoice_show_tab`` context variable to :const:`False`::
context = RequestContext({'uservoice_show_tab': False})
return some_template.render(context)
However, instead consider only setting the widget key in the views you
do want to show the widget on.
Showing a second widget
.......................
Use the :ttag:`uservoice_popup` tag with a widget_key to display a
different widget that the one configured in the
:const:`USERVOICE_WIDGET_KEY` setting or the ``uservoice_widget_key``
template context variable::
<a href="#" onclick="{% uservoice_popup 'XXXXXXXXXXXXXXXXXXXX' %}; return false;">Helpdesk</a>
In this case, the default widget tab is not hidden.
Passing custom data into the helpdesk
-------------------------------------
You can pass custom data through your widget and into the ticketing
system. First create custom fields in your *Tickets* settings page.
Deselect *Display on contact form* in the edit dialog for those fields
you intend to use from Django. You can set values for this field by
passing the :data:`uservoice_fields` context variables to the
template::
uservoice_fields = {
'Type': 'Support Request',
'Priority': 'High',
}
context = RequestContext({'uservoice_fields': uservoice_fields})
return some_template.render(context)
You can instead use a context processor, but because of the way context
variables work in Django, you cannot use both. The fields set in the
context processor will clobber all fields set in the
:class:`~django.template.context.RequestContext` constructor.
Using Single Sign-On
--------------------
If your websites authenticates users, you will be able to let them give
feedback without having to create a UserVoice account.
*This feature is in development*
See also :ref:`identifying-visitors`.
----