[ckan-dev] template code duplication and complexity - some thoughts

Toby Dacre toby.okfn at gmail.com
Mon Nov 12 11:56:48 UTC 2012


Hi,

The templates seem to be starting to get a bit complex and contain code
duplication

examples

1) follower numbers is effectively repeated in user/read.html and
ajax_snippets/popover-context-user.html (that template name also breaks the
template naming conventions should be popover_context_user.html)

If a snippet was used then that would make it easier for customisation by
customers. eg not showing number of edits

Additionally the class="nums" seems very generic maybe "follower_numbers"?

2) in user/read.html having the user info (sidebar) as a snippet would
allow easier customization

3) in user/read.html having the 'section tabs' as a snippet would make it
easier to add/remove tabs for custom needs at least having the tabs in
their own block to allow easy replacement.

4) with user/read.html as it has now expanded to multiple uses should we
not create a proper user/read_base.html (better name though) rather than
dual using user/read.html for both a template base and for showing datasets?

Keeping the templates clean simple and well separated makes
customization/expansion far easier so I think is worth the effort
especially as it will have long term impacts as once 2.0 is released
changing templates/blocks etc can cause compatibility issues between
versions

cheers
Toby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20121112/8e36b20a/attachment.html>


More information about the ckan-dev mailing list