[ckan-dev] template helper function problem
Koebrick, Andrew (MNIT)
andrew.koebrick at state.mn.us
Tue Jan 28 16:48:36 UTC 2014
Nigel,
Thanks for the response. Originally I did use a standard div block to write out our warning, just like you suggested. And I can go back to that route. But the flash_notice function seemed to be designed just for this sort of thing. The templates/home/index.html file already has this in it to display flash notices:
{{ self.flash() }}
I am just looking for a clean way to inject content into the element. Perhaps I can try to do it in my extension’s plugin.py.
Andrew
From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Nigel Babu
Sent: Tuesday, January 28, 2014 12:40 AM
To: CKAN Development Discussions
Subject: Re: [ckan-dev] template helper function problem
I think what you're doing wrong is using h.flash_notice (I'm not sure) when the template already has flash messages printed once. You should probably just use alert directly<https://github.com/okfn/ckanext-demo/blob/warning/ckanext/demo/templates/header.html>.
Nigel Babu
Developer | @nigelbabu<https://twitter.com/nigelbabu>
The Open Knowledge Foundation<http://okfn.org/>
Empowering through Open Knowledge
http://okfn.org/ | @okfn<http://twitter.com/OKFN> | OKF on Facebook<https://www.facebook.com/OKFNetwork> | Blog<http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter>
CKAN | http://ckan.org/ | @CKANproject<http://twitter.com/CKANproject> | the world’s leading open-source data portal platform
On 28 January 2014 03:10, Koebrick, Andrew (MNIT) <andrew.koebrick at state.mn.us<mailto:andrew.koebrick at state.mn.us>> wrote:
I have added this line to my index.html template just after {% block content %}:
{{ h.flash_notice('<b>Note</b>: This site is in development and is intended for evaluation purposes only. Data found here should be considered test data only!', allow_html=True) }}
Although it works successfully, it also injects the word "None" into my HTML:
<header class="masthead">
+<div class="container">
</header>
None
<div class="hero" role="main">
+<div id="content" class="container">
</div>
Any thoughts on what I am doing wrong?
Thanks,
Andrew Koebrick
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140128/0e294237/attachment-0003.html>
More information about the ckan-dev
mailing list