Clarified the commenting and changed the layout template to show adding groups
[ckanext-datagovau.git] / README.rst
1 This CKAN Extension demonstrates some common patterns for customising a CKAN instance.
2
3 It comprises:
4
rgrp 5 * A CKAN Extension "plugin" at ``ckanext/example/plugin.py`` which, when
6 loaded, overrides various settings in the core ``ini``-file to provide:
7
rgrp 8 * A path to local customisations of the core templates and stylesheets
9 * A "stream filter" that replaces arbitrary strings in rendered templates
10 * A "route" to override and extend the default behaviour of a core CKAN page
11
12 * A custom Pylons controller for overriding some core CKAN behaviour
13
14 * A custom Package edit form
15
Ross Jones 16 * A plugin that allows for custom forms to be used for datasets based on
17 their "type".
Ross Jones 18
19 * A custom User registration and edition form
20
Ian Murray 21 * Some simple template customisations
22
rgrp 23 Installation
24 ============
Seb Bacon 25
26 To install this package, from your CKAN virtualenv, run the following from your CKAN base folder (e.g. ``pyenv/``)::
27
28 pip install -e git+https://github.com/okfn/ckanext-example#egg=ckanext-example
29
rgrp 30 Then activate it by setting ``ckan.plugins = example`` in your main ``ini``-file.
Seb Bacon 31
rgrp 32
Seb Bacon 33 Orientation
34 ===========
35
36 * Examine the source code, starting with ``ckanext/example/plugin.py``
37
rgrp 38 * To understand the nuts and bolts of this file, which is a CKAN
Seb Bacon 39 *Extension*, read in conjunction with the "Extension
40 documentation": http://docs.ckan.org/en/latest/plugins.html
41
David Read 42 * One thing the extension does is set the values of
Seb Bacon 43 ``extra_public_paths`` and ``extra_template_paths`` in the CKAN
44 config, which are "documented
45 here": http://docs.ckan.org/en/latest/configuration.html#extra-template-paths
46
David Read 47 * These are set to point at directories within
Seb Bacon 48 ``ckanext/example/theme/`` (in this package). Here we:
49 * override the home page HTML ``ckanext/example/theme/templates/home/index.html``
David Read 50 * provide some extra style by serving ``extra.css`` (which is loaded using the ``ckan.template_head_end`` option
51 * customise the navigation and header of the main template in the file ``layout.html``.
52
53 The latter file is a great place to make global theme alterations.
Seb Bacon 54 It uses the _layout template_ pattern "described in the Genshi
55 documentation":http://genshi.edgewall.org/wiki/GenshiTutorial#AddingaLayoutTemplate.
56 This allows you to use Xpath selectors to override snippets of HTML
57 globally.
58
59 * The custom package edit form at ``package_form.py`` follows a deprecated
60 way to make a form (using FormAlchemy). This part of the Example Theme needs
Ian Murray 61 updating. In the meantime, follow the instructions at:
62 http://readthedocs.org/docs/ckan/en/latest/forms.html
63
64