Skip to content

Commit

Permalink
Update documentation with block-snippet-button.
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Aug 25, 2015
1 parent a5b1811 commit a688433
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions docs/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Using the staging server
In order to develop a snippet properly, you must add your snippet to a test
instance of the snippet service. You may either user the staging instance of
snippets at https://snippets.allizom.org, or you may set up a local instance of
the snippets service using the :doc:`installation documentation <install>`.
the snippets service using the :doc:`installation documentation <contributing>`.

To get access to the staging server, ask the snippets team via the bug you've
filed in Bugzilla.
Expand Down Expand Up @@ -209,9 +209,18 @@ Snippet developers can send custom pings to capture interactions, clicks and oth
Snippet Block List
^^^^^^^^^^^^^^^^^^

Snippets can be prevented from showing using a block list. By default the block list is empty and the intention is to allow users to block specific snippets from showing by taking an action. For example a disruptive snippet can include a special `Do not display again` link that adds the snippet into the block list.
Snippets can be prevented from showing using a block list. By default the block list is empty and the intention is to allow users to block specific snippets from showing by taking an action. Snippet service automatically assigns the block functionality to all elements of snippet with class `block-snippet-button`. For example a disruptive snippet can include a special `Do not display again` link that adds the snippet into the block list:

.. code-block:: html

<!-- Use Raw Template to try this out -->
<div class="snippet" id="block-snippet-[[snippet_id]]">
Foo! <a href="#" class="block-snippet-button">Do not show again</a>
</div>


If you need more control you can directly access the low-level function `addToBlockList`:

.. code-block:: html

<!-- Use Raw Template to try this out -->
Expand All @@ -235,6 +244,15 @@ Snippets can be prevented from showing using a block list. By default the block
//]]>
</script>

.. note::
In this case we don't utilize the special `block-snippet-button` class.


In bug `1172579`_ close button assets are provided to build a image
button in your snippet. Refer to the `simple snippet`_ code on how to
do this.


.. _testing:

Testing
Expand Down Expand Up @@ -289,3 +307,5 @@ person for review. If your snippet is already on the staging server, include
the URL for editing it to make it easier for the reviewer to test it.

.. _snippets Github repo: https://github.com/mozilla/snippets
.. _1172579: https://bugzilla.mozilla.org/show_bug.cgi?id=1172579
.. _simple snippet: https://github.com/mozilla/snippets/blob/master/templates/simple-snippet.html

0 comments on commit a688433

Please sign in to comment.