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