You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Carl Bourne <ca...@me.com> on 2012/09/19 16:13:30 UTC

Third Party JavaScript libraries

Hi,

I would like to use the moments.js  http://momentjs.com/ library in my CouchDB map views. 

Would somebody mind explaining if indeed this is possible and the best approach for adding it.

Best Regards,

Carl

Re: Third Party JavaScript libraries

Posted by Ryan Ramage <ry...@gmail.com>.
>
> Does this mean I can get access to moments from within may map logic or does it strictly relate to views only?

Carl, I am not sure what you mean. But yes, you can access moment.js
from your map function for a view. If you want you can also use it in
list, update, and show functions.

Re: Third Party JavaScript libraries

Posted by Carl Bourne <ca...@me.com>.
Thanks Ryan,

Does this mean I can get access to moments from within may map logic or does it strictly relate to views only?

On 19 Sep 2012, at 15:39, Ryan Ramage <ry...@gmail.com> wrote:

> Carl,
> 
> Yes, you sure can. Here is an example view using moment
> 
> https://github.com/datacitizen/water-quality/blob/master/lib/views.js#L44
> 
> The view is a little complicated, but at least you can see a spot
> where moment is being used. Because it is being used in a view, you
> have to have it at a certain spot in your design doc. Your design doc
> should have something like this
> 
> ddoc.views.lib.moment = "// moment.js// version : 1.6.2// author : Tim
> Wood// l...."
> 
> Here is a the design doc, when it is on couch:
> 
> http://nwt.iriscouch.com/_utils/document.html?water-quality/_design/water-quality
> 
> Of course, using a couchapp tool like kanso makes this stuff easier,
> but at least you should get the general idea how it is working.
> 
> Ryan
> 
> 
> 
> 
> On Wed, Sep 19, 2012 at 8:13 AM, Carl Bourne <ca...@me.com> wrote:
>> Hi,
>> 
>> I would like to use the moments.js  http://momentjs.com/ library in my CouchDB map views.
>> 
>> Would somebody mind explaining if indeed this is possible and the best approach for adding it.
>> 
>> Best Regards,
>> 
>> Carl


Re: Third Party JavaScript libraries

Posted by Gabriel Mancini <ga...@gmail.com>.
use kanso for this... http://kan.so/



On Wed, Sep 19, 2012 at 11:39 AM, Ryan Ramage <ry...@gmail.com> wrote:

> Carl,
>
> Yes, you sure can. Here is an example view using moment
>
> https://github.com/datacitizen/water-quality/blob/master/lib/views.js#L44
>
> The view is a little complicated, but at least you can see a spot
> where moment is being used. Because it is being used in a view, you
> have to have it at a certain spot in your design doc. Your design doc
> should have something like this
>
> ddoc.views.lib.moment = "// moment.js// version : 1.6.2// author : Tim
> Wood// l...."
>
> Here is a the design doc, when it is on couch:
>
>
> http://nwt.iriscouch.com/_utils/document.html?water-quality/_design/water-quality
>
> Of course, using a couchapp tool like kanso makes this stuff easier,
> but at least you should get the general idea how it is working.
>
> Ryan
>
>
>
>
> On Wed, Sep 19, 2012 at 8:13 AM, Carl Bourne <ca...@me.com> wrote:
> > Hi,
> >
> > I would like to use the moments.js  http://momentjs.com/ library in my
> CouchDB map views.
> >
> > Would somebody mind explaining if indeed this is possible and the best
> approach for adding it.
> >
> > Best Regards,
> >
> > Carl
>



-- 
Gabriel Mancini de Campos
Arquiteto de Soluções

+55 (11) 9449-1706
gabriel.mancini@gmail.com
São Paulo - SP - Brasil

Re: Third Party JavaScript libraries

Posted by Ryan Ramage <ry...@gmail.com>.
Carl,

Yes, you sure can. Here is an example view using moment

https://github.com/datacitizen/water-quality/blob/master/lib/views.js#L44

The view is a little complicated, but at least you can see a spot
where moment is being used. Because it is being used in a view, you
have to have it at a certain spot in your design doc. Your design doc
should have something like this

ddoc.views.lib.moment = "// moment.js// version : 1.6.2// author : Tim
Wood// l...."

Here is a the design doc, when it is on couch:

http://nwt.iriscouch.com/_utils/document.html?water-quality/_design/water-quality

Of course, using a couchapp tool like kanso makes this stuff easier,
but at least you should get the general idea how it is working.

Ryan




On Wed, Sep 19, 2012 at 8:13 AM, Carl Bourne <ca...@me.com> wrote:
> Hi,
>
> I would like to use the moments.js  http://momentjs.com/ library in my CouchDB map views.
>
> Would somebody mind explaining if indeed this is possible and the best approach for adding it.
>
> Best Regards,
>
> Carl