[readme][xs]: more formatting.
[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
16 * Some simple template customisations
17
Seb Bacon 18 Installation
19 ============
20
21 To install this package, from your CKAN virtualenv, run the following from your CKAN base folder (e.g. ``pyenv/``)::
22
rgrp 23 pip install -e git+https://github.com/okfn/ckanext-example#egg=ckanext-example
Seb Bacon 24
rgrp 25 Then activate it by setting ``ckan.plugins = example`` in your main ``ini``-file.
Seb Bacon 26
27
28 Orientation
29 ===========
30
rgrp 31 * Examine the source code, starting with ``ckanext/example/plugin.py``
Seb Bacon 32
33 * To understand the nuts and bolts of this file, which is a CKAN
34 *Extension*, read in conjunction with the "Extension
35 documentation":http://packages.python.org/ckan/plugins.html
36
37 * One thing the extension does is set the values of
38 ``extra_public_paths`` and ``extra_template_paths`` in the CKAN
39 config, which are "documented
40 here":http://packages.python.org/ckan/configuration.html#extra-template-paths
41
42 * These are set to point at directories within
rgrp 43 `ckanext/example/theme/`` (in this package). Here, we override
Seb Bacon 44 the home page, provide some extra style with an ``extra.css``, and
45 customise the navigation and header of the main template in the file ``layout.html``.
46
47 The latter file is a great place to make global theme alterations.
48 It uses the _layout template_ pattern "described in the Genshi
49 documentation":http://genshi.edgewall.org/wiki/GenshiTutorial#AddingaLayoutTemplate.
50 This allows you to use Xpath selectors to override snippets of HTML
51 globally.
52
53 * The custom package edit form at ``package_form.py`` follows the
54 conventions in the "main CKAN
55 documentation":http://packages.python.org/ckan/forms.html
56