[ckan-dev] RFC snippets

Toby Dacre toby.okfn at gmail.com
Fri Apr 13 11:35:33 UTC 2012


On 13 April 2012 12:27, Sean Hammond <sean.hammond at okfn.org> wrote:

> > The idea is to have a folder of snippets in templates that can then be
> > rendered  as needed via a helper function.  This helps reduce the
> > size/complexity of _util.html etc.  It allows individual page components
> to
> > be easily customised by extensions without duplicating content which
> > remains identical.
> >
> > example:
> >
> > ${h.snippet('package_list', packages=packages)}
> >
> > This renders the template "snippets/package_list.html" passing
> {'packages'
> > : packages} and inserts it into the page.
>
> Seems like a great idea to me.
>
> > Should we be more explicit in passing the full template name?
>
> I think so, yes. It'd be good if I could look at a call to h.snippet and
> see immediately which template file it was calling, without having to
> know that 'package_list' maps to some file.
>

yep I'm going to do this also adding
<!-- Snippet snippets/my_snippet.html start -->
..
<!-- Snippet snippets/my_snippet.html end -->
to the generated html too

>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120413/bb752108/attachment-0001.html>


More information about the ckan-dev mailing list