X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fquery%2Fevently%2Ftagcloud%2F_init%2Fdata.js;fp=web%2Fquery%2Fevently%2Ftagcloud%2F_init%2Fdata.js;h=06dddf14b7b5f2c07cdbc32616a48a57af5f1426;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44 diff --git a/web/query/evently/tagcloud/_init/data.js b/web/query/evently/tagcloud/_init/data.js new file mode 100644 index 0000000..06dddf1 --- /dev/null +++ b/web/query/evently/tagcloud/_init/data.js @@ -0,0 +1,25 @@ +function(resp) { + var app = $$(this).app; + var path = app.require("vendor/couchapp/lib/path").init(app.req); + var tags = []; + resp.rows.forEach(function(r) { + var tag = r.key[0]; + // todo remove duplication of link definitions + var link = path.list("index","tags",{ + descending : true, + reduce : false, + limit : 10, + startkey : [tag, {}], + endkey : [tag]}); + tags.push({ + tag : tag, + link : link, + size : (r.value * 2) + 10 + }); + }); + return { + tags : tags.sort(function(a, b) { + return a.size < b.size; + }) + }; +} \ No newline at end of file