Mercurial > libervia-web
changeset 1170:4648a333b33f
doc: use "sourcecode" directive instead of "code" + small mistakes fixes:
RST "code" directive is not always working well with "jinja" code. It has been replaced with sphinx specific "sourcecode" (alias of "code-block", nicer to read in not formatted doc) which is working better.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Apr 2019 14:12:53 +0200 |
parents | 97e850e6fae9 |
children | 469d0de8da0e |
files | doc/web_framework/css_framework.rst doc/web_framework/quick_start.rst |
diffstat | 2 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/web_framework/css_framework.rst Fri Apr 12 14:08:02 2019 +0200 +++ b/doc/web_framework/css_framework.rst Fri Apr 12 14:12:53 2019 +0200 @@ -2,7 +2,7 @@ ====================== -Libervia come with generic CSS styling which is thought to be re-usable. If you create a new theme/site, you don't have to use it and can use something totally different, but building on top of Libervia CSS make theming more easy and consistent as you can re-use existant components without changing the classes. +Libervia comes with generic CSS styling which is thought to be re-usable. If you create a new theme/site, you don't have to use it and can use something totally different, but building on top of Libervia CSS make theming more easy and consistent as you can re-use existant components without changing the classes. Bases ----- @@ -34,7 +34,7 @@ There are only a few of them: box--expand - When this class is applied, the box will be folded when is higher than 250px, and 2 "expand zone" (buttons) + When this class is applied, the box will be folded when higher than 250px, and 2 "expand zone" (buttons) will be added on top and bottom of the box to expand/reduce it. state_init @@ -58,13 +58,13 @@ Display this class only if in ``state_init``. show_if_parent_clicked - display this class only if **parent** is in ``state_clicked`` + display this class only if **parent** is in ``state_clicked`` show_if_parent_not_clicked - display this class only if **parent** is **not** in ``state_clicked`` + display this class only if **parent** is **not** in ``state_clicked`` show_if_grandparent_clicked - display this class only if **grandparent** is in ``state_clicked`` + display this class only if **grandparent** is in ``state_clicked`` show_if_grandparent_not_clicked - display this class only if **grandparent** is **not** in ``state_clicked`` + display this class only if **grandparent** is **not** in ``state_clicked``
--- a/doc/web_framework/quick_start.rst Fri Apr 12 14:08:02 2019 +0200 +++ b/doc/web_framework/quick_start.rst Fri Apr 12 14:12:53 2019 +0200 @@ -29,7 +29,7 @@ Now we have to declare this new site to Salut à Toi and Libervia. When installing Salut à Toi, you should have created a ``sat.conf`` file, if not, just create one at ``~/.sat.conf``. Edit this file, and in the section ``[DEFAULT]``, add the following setting: -.. code:: javascript +.. sourcecode:: javascript sites_path_public_dict = { "quick_start": "~/dev/libervia_quick_start" @@ -37,12 +37,12 @@ This declare the templates of your websites, you'll now be able to use them with tools like ``jp``. -Now you have to add your site to Libervia. Choose a host name, and link it the site name by adding a ``vhost_dict`` setting in your ``[libervia]`` section of ``sat.conf``: +Now you have to add your site to Libervia. Choose a host name, and link it to the site name by adding a ``vhost_dict`` setting in your ``[libervia]`` section of ``sat.conf``: -.. code:: javascript +.. sourcecode:: javascript vhosts_dict = {"quickstart.int": "quick_start"} - + That means that when you'll get to ``quickstart.int``, you'll land to your own site instead of official Libervia one. Last but not least, you have to declare this website as alias for your localhost during developments. On GNU/Linux, this is done by editing ``/etc/hosts`` (as root user), to have something like that:: @@ -52,8 +52,8 @@ To see your website, you'll have to use the specified host name, and the port used by Libervia (8080 by default). If you kept default configuration, let's go to http://quickstart.int:8080. -But for now, you'll just see ``No Such Resource`` (if you see standard Libervia site, that means that something is not working, you can check for assistance in our XMPP room (`sat@chat.jabberfr.org <xmpp:sat@chat.jabberfr.org?join>`_)). - +But for now, you'll just see ``No Such Resource`` (if you see standard Libervia site, that means that something is not working, you can check for assistance in our XMPP room at `sat@chat.jabberfr.org <xmpp:sat@chat.jabberfr.org?join>`_). + All right? Good, let's start then. A first template @@ -62,7 +62,7 @@ For this simple page, we won't have any data to manipulate, so let's start directly with the template. Create a ``salut.html`` file at ``templates/default/salut/salut.html`` inside your development directory, and put the following content inside: -.. code:: jinja +.. sourcecode:: jinja {% if not embedded %}{% extends 'base/base.html' %}{% endif %} @@ -74,13 +74,13 @@ The template use Jinja2_ engine, which is easy to learn and powerful. You have the documentation available on the official website, you should read in particular the `Template Designer Documentation <http://jinja.pocoo.org/docs/latest/templates/>`_. -.. code:: jinja +.. sourcecode:: jinja {% if not embedded %}{% extends 'base/base.html' %}{% endif %} This firt line should be present on every front page, it extends the base template which handle many things for you and to facilitate integration with the backend. "But I have not written any ``base/base.html`` template" you may say. That's right, that's because SàT template engine is looking for file in several places. When you link a template, first it will check the current theme of your site, then the ``default`` theme, and finally the ``default`` theme of SàT official site. That allows you to have access to the generic features like the backend integration. -.. code:: jinja +.. sourcecode:: jinja {% block body %} Salut à Toi le monde ! @@ -94,7 +94,7 @@ We have a template, but we need a page to use it. Pages are put in a directories hierarchy which correspond directly to your URL hierarchy, simple! To be used as a Libervia page, a directory must contain a file named ``page_meta.py``. So to create your first page, you just have to create the file ``pages/salut/page_meta.py`` and put this inside: -.. code:: python +.. sourcecode:: python #!/usr/bin/env python2.7 #-*- coding: utf-8 -*- @@ -113,7 +113,7 @@ But if you go to http://quickstart.int:8080 you still see this annoying ``No Such Resource``, would not it be nice to land directly to your salut page? All you have to do for that, is to add a couple of lines in your ``sat.conf``, once again in ``[libervia]`` section: -.. code:: javascript +.. sourcecode:: javascript url_redirections_dict = { "quick_start": {