Skip to content

Commit

Permalink
more on boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaitan committed Oct 6, 2014
1 parent 1ad569e commit dbd9c74
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/boxes.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Boxes: Waliki as a (dummy) CMS
==============================

The templatetag :func:`waliki_box` allow to render a wiki page content as a portion (a "box") of a webpage, and allow a rapid edition if the user has the right permission.
The templatetag ``waliki_box`` allow to render the body of a wiki page as a portion (a "box") of a webpage, and a rapid inline edition if the user has the right permission.

The templatetag receives the page slug as only parameter::
The templatetag receives the page's slug as only parameter::

{% waliki_box "page/slug" %}

Expand Down Expand Up @@ -48,14 +48,19 @@ Where ``boxes_example.html`` is as following:

{% endblock %}

You can `see this example <http://waliki.pythonanywhere.com/boxes-example/>` live in the demo site. Note that the demo site apply an :ref:`ACL rule <acl_>`
You can `see this example <http://waliki.pythonanywhere.com/boxes-example/>`_ live in the demo site. Note that the demo site apply an :ref:`ACL rule <acl_>`
to limit the edition of the any block under the *namespace* ``boxes`` to authenticated users.

`Login <http://waliki.pythonanywhere.com/accounts/login/?next=/boxes-example/>`_ to edit the boxes!

.. tip:: As you can see in the code of the template, the last box is all yours,
because it will render "boxes/footer/<your_username>" :)
Context dependent boxes
------------------------

As you can see in the code of the template, the last box is specificly for you, because it will render ``boxes/footer/<your_username>``.

This technique can be used, for example, to display a different content
for different languages::

{% waliki_box "my-content/"|add:request.LANGUAGE_CODE %}

This will display ``my-content/en`` for English, ``my-content/es`` for Spanish, etc.

0 comments on commit dbd9c74

Please sign in to comment.