[ckan-dev] How can I use underscorejs in javascript module

Vitor Baptista vitor at vitorbaptista.com
Fri May 30 12:18:57 UTC 2014


Hi Qifeng,

You can add dependencies using fanstatic. For example, check
https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/theme/public/resource.config
. That resource.config file configures the JS and CSS dependencies used in
the extension. To make CKAN know you've created it, you need to call
ckan.plugins.toolkit.add_resource() in your extension (as in
https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/plugin.py#L21-L23),
and then you can add that to any template you'd like, as in
https://github.com/ckan/ckanext-basiccharts/blob/master/ckanext/basiccharts/theme/templates/basechart_view.html#L1

Cheers.


2014-05-27 23:57 GMT-03:00 <Qifeng.Bai at csiro.au>:

>  I thought I solved. The underscorejs does apprea under Chrome debug
> tools, but cannot be used in the JavaScript module
>
>
>
> *From:* ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] *On Behalf Of *
> Qifeng.Bai at csiro.au
> *Sent:* Tuesday, 27 May 2014 1:04 PM
> *To:* ckan-dev at lists.okfn.org
> *Subject:* [ExternalEmail] [ckan-dev] How can I use underscorejs in
> javascript module
>
>
>
> Hi, there
>
>
>
> Is there anyone who knows how to refer a third party library into CKAN?  I
> want to use underscorejs in my own javascript module, where should I put
> undersorejs and where – in javascript module ? or html? and how to refer
> it?
>
>
>
> Many thanks
>
> Cheers
>
>
>
>
>
>
>
> [image: cid:image001.gif at 01CC55BF.85E7FEB0]
>
> Qifeng Bai
> Software Engineer
> CSIRO Land and Water
> Black Mountain, Canberra
>
> Ph: +61-2-62465704
> Web: www.clw.csiro.au
>
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 

Vítor Baptista

Developer  |  http://vitorbaptista.com | LinkedIn
<http://www.linkedin.com/in/vitorbaptista> | @vitorbaptista
<http://twitter.com/vitorbaptista>

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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140530/6ef0ec8d/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2094 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140530/6ef0ec8d/attachment-0003.gif>


More information about the ckan-dev mailing list