From adc8f8fa520a3d6adf3fb281fedff691f9ad55c2 Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Fri, 20 Apr 2012 22:23:00 +0200 Subject: [PATCH] Update doc to match new quickstart templates --- docs/main/QuickStart.rst | 9 +-- docs/main/explorequickstart.rst | 117 +++++++++++--------------------- 2 files changed, 39 insertions(+), 87 deletions(-) diff --git a/docs/main/QuickStart.rst b/docs/main/QuickStart.rst index 80b3f36..df8d274 100644 --- a/docs/main/QuickStart.rst +++ b/docs/main/QuickStart.rst @@ -43,13 +43,6 @@ Here's what our choices for this tutorial look like:: This will create a new directory which contains a few files in a directory tree, with some code already set up for you. -.. note:: - - Passing ``--minimal`` to the ``paster quickstart`` command will - create an empty project with only the RootController. - While this is not reccomended for new users it might speed up the - process of starting a new project for expert users. - Let's go in there and you can take a look around. .. code-block:: bash @@ -270,4 +263,4 @@ What's Next? .. _SQLite: http://www.sqlite.org .. _MongoDB: http://www.mongodb.org -.. _Ming: http://merciless.sourceforge.net/tour.html \ No newline at end of file +.. _Ming: http://merciless.sourceforge.net/tour.html diff --git a/docs/main/explorequickstart.rst b/docs/main/explorequickstart.rst index e75f6de..4507da2 100644 --- a/docs/main/explorequickstart.rst +++ b/docs/main/explorequickstart.rst @@ -207,7 +207,9 @@ Template Example ~~~~~~~~~~~~~~~~ A simple template file called ``sample`` could be made like -this:: +this: + +.. code-block:: html+genshi @@ -243,10 +245,12 @@ We provide them by adding a method to the controller like this ... Quickstarted Project Templates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Each projects gets quickstarted with a Master template and a bunch of templates for +the pages provided by the RootController. Taking a look at the `index` template it should +look something like this: + .. code-block:: html+genshi - @@ -254,37 +258,27 @@ Quickstarted Project Templates - - Welcome to TurboGears 2.1, standing on the - shoulders of giants, since 2007 + Welcome to TurboGears 2.2, standing on the shoulders of giants, since 2007 - ${sidebar_top()} -
-

Presentation

-

TurboGears 2 is rapid web application development toolkit designed - to make your life easier.

-
    -
  1. -

    Code your data model

    -

    Design your data model, Create the database, and Add some - bootstrap data.

    -
  2. -
  3. -

    Design your URL architecture

    -

    Decide your URLs, Program your controller methods, Design your - templates, and place some static files (CSS and/or JavaScript).

    -
  4. -
  5. -

    Distribute your app

    -

    Test your source, Generate project documents, Build a distribution.

    -
  6. -
-
-
-
Thank you for choosing TurboGears. +
+
+
+

Welcome to TurboGears 2.2

+

If you see this page it means your installation was successful!

+

TurboGears 2 is rapid web application development toolkit designed to make your life easier.

+

+ + ${h.icon('book', True)} Learn more + +

+
+
+ + [ ... ] + @@ -293,61 +287,26 @@ Let's pay attention to a couple of important lines: .. code-block:: html+genshi - ${sidebar_top()} - -the xi:include statement pulls in master.html, and includes it in this template's namespace. Which is how the next thing gets pulled in since sidebar.html is included in master.html. -This allows you to break your template files into reusable components. - -Perhaps the most used feature of genshi is the ``${}`` syntax, which means that genshi should insert the value of the python expression inside into the template at that point in the page. In this case it's calling a genshi template function that renders the sidebar. - -This template function is defined in sidebars.html: +the `xi:include` statement pulls in master.html, and includes it in this template's namespace. +This makes possible to have a template where the global layout and look of the site is defined +while the other templates can just implement the different content +allowing you to break your template files into reusable components. .. code-block:: html+genshi - - - - -``py:def`` is a special genshi tag that allows you to create a reusable -template function. You'll notice that we use ``${tg.url('/about')}`` in -this template function, to generate the link to about. The tg.url function -creates a URL for you, but it takes into acount where the tg2 app has been -mounted in our URL tree. So if you're app is mounted via apache and mod-wsgi -at /mywebsite/dynamic/tg2/my-intranet ``/about`` will be turned into the proper -``mywebsite/dynamic/tg2/my-intranet``. tg.url actually does quite a bit -more than that, but we'll get into that later. - -You'll also notice a couple of other interesting attributes here: - -.. code-block:: html+genshi + + ${h.icon('book', True)} Learn more + -
  • - ...... -
  • +Perhaps the most used feature of genshi is the ``${}`` syntax, +which means that genshi should insert the value of the python expression inside into the template +at that point in the page. +In this case it renders the icon of a book using the ``icon`` helper. -Genshi provides a number of special processing attributes that allow you to - conditionally display something the most standard of which is py:if that - just displays the tag if the reqult is true. Here we have py:choose which, - with py:when and py:otherwise allows you to choose between one of many - possible things to render in the
  • . +Genshi also provides a number of special processing attributes that allow you to +conditionally display something the most standard of which is ``py:if`` that +just displays the tag if the result is true. You can find a full list and explanation of the genshi tags here: