Updated for ckan 1.5. (Form still needs updating, but this is noted in README.)
--- /dev/null
+++ b/.gitignore
@@ -1,1 +1,10 @@
-
+*.egg-info
+*.pyc
+*.swp
+*.swo
+*~
+#*
+.#*
+build/
+dist/
+distribute-*
--- a/.hgignore
+++ /dev/null
@@ -1,11 +1,1 @@
-syntax: glob
-*.egg-info
-*.pyc
-*.swp
-*.swo
-*~
-#*
-.#*
-build/
-dist/
--- a/README.rst
+++ b/README.rst
@@ -2,19 +2,18 @@
It comprises:
- * A CKAN Extension "plugin" at ``ckanext/example/plugin.py``
- which, when loaded, overrides various settings in the core
- ``ini``-file to provide:
+* A CKAN Extension "plugin" at ``ckanext/example/plugin.py`` which, when
+ loaded, overrides various settings in the core ``ini``-file to provide:
- * A path to local customisations of the core templates and stylesheets
- * A "stream filter" that replaces arbitrary strings in rendered templates
- * A "route" to override and extend the default behaviour of a core CKAN page
+ * A path to local customisations of the core templates and stylesheets
+ * A "stream filter" that replaces arbitrary strings in rendered templates
+ * A "route" to override and extend the default behaviour of a core CKAN page
- * A custom Pylons controller for overriding some core CKAN behaviour
+* A custom Pylons controller for overriding some core CKAN behaviour
- * A custom Package edit form
+* A custom Package edit form
- * Some simple template customisations
+* Some simple template customisations
Installation
============
@@ -33,17 +32,18 @@
* To understand the nuts and bolts of this file, which is a CKAN
*Extension*, read in conjunction with the "Extension
- documentation":http://packages.python.org/ckan/plugins.html
+ documentation": http://docs.ckan.org/en/latest/plugins.html
* One thing the extension does is set the values of
``extra_public_paths`` and ``extra_template_paths`` in the CKAN
config, which are "documented
- here":http://packages.python.org/ckan/configuration.html#extra-template-paths
+ here": http://docs.ckan.org/en/latest/configuration.html#extra-template-paths
* These are set to point at directories within
- `ckanext/example/theme/`` (in this package). Here, we override
- the home page, provide some extra style with an ``extra.css``, and
- customise the navigation and header of the main template in the file ``layout.html``.
+ ``ckanext/example/theme/`` (in this package). Here we:
+ * override the home page HTML ``ckanext/example/theme/templates/home/index.html``
+ * provide some extra style by serving ``extra.css`` (which is loaded using the ``ckan.template_head_end`` option
+ * customise the navigation and header of the main template in the file ``layout.html``.
The latter file is a great place to make global theme alterations.
It uses the _layout template_ pattern "described in the Genshi
@@ -51,7 +51,9 @@
This allows you to use Xpath selectors to override snippets of HTML
globally.
-* The custom package edit form at ``package_form.py`` follows the
- conventions in the "main CKAN
- documentation":http://packages.python.org/ckan/forms.html
+* The custom package edit form at ``package_form.py`` follows a deprecated
+ way to make a form (using FormAlchemy). This part of the Example Theme needs
+ updating. In the meantime, follow the instructions at:
+ http://readthedocs.org/docs/ckan/en/latest/forms.html
+
--- a/ckanext/example/plugin.py
+++ b/ckanext/example/plugin.py
@@ -54,8 +54,11 @@
config.get('extra_public_paths', '')])
config['extra_template_paths'] = ','.join([template_dir,
config.get('extra_template_paths', '')])
+ # add in the extra.css
+ config['ckan.template_head_end'] = config.get('ckan.template_head_end', '') +\
+ '<link rel="stylesheet" href="/css/extra.css" type="text/css"> '
# set the title
- config['ckan.site_title'] = "An example CKAN theme"
+ config['ckan.site_title'] = "Example CKAN theme"
# set the customised package form (see ``setup.py`` for entry point)
config['package_form'] = "example_form"
--- a/ckanext/example/theme/templates/layout.html
+++ b/ckanext/example/theme/templates/layout.html
@@ -9,12 +9,9 @@
<!-- ! a custom primary nav -->
<py:match path="//div[@class='menu']">
<div class="menu">
- <ul>
- <li>${h.nav_link(c, _('Home'), controller='home', action='index', id=None)}
- </li>
- <li>${h.nav_link(c, _('Data'), controller='package', action='index', id=None)}
- </li>
- </ul>
+ ${h.nav_link(c, _('Home'), controller='home', action='index', id=None)}
+ ${h.nav_link(c, _('Data'), controller='package', action='index', id=None)}
+ ${h.nav_link(c, _('New dataset'), controller='package', action='new', id=None)}
</div>
</py:match>