diff options
author | Jochen Topf <jochen@topf.org> | 2010-12-13 22:09:23 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2010-12-13 22:09:23 +0100 |
commit | 656f7e390ec007fdeaeea2953cbf96c655144f96 (patch) | |
tree | 1ff84216de3b9f3992e3dcf661afb7fec6582c6d | |
parent | 0da1ebbbdb94f00f6b8a27aa5be2094fc3a1961f (diff) | |
download | taginfo-656f7e390ec007fdeaeea2953cbf96c655144f96.tar taginfo-656f7e390ec007fdeaeea2953cbf96c655144f96.tar.gz |
more new style javascript
-rw-r--r-- | web/public/js/taginfo.js | 36 | ||||
-rw-r--r-- | web/views/reports/wiki_pages_about_non_existing_keys.erb | 53 |
2 files changed, 43 insertions, 46 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index e88e7ba..30bcece 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -567,6 +567,42 @@ var create_flexigrid_for = { } }, reports: { + wiki_pages_about_non_existing_keys: function() { + create_flexigrid('grid-keys', { + url: '/api/2/db/keys?filters=in_wiki,not_in_db&include=wikipages', + colModel: [ + { display: '<img src="/img/sources/wiki.16.png" alt="Wiki" title="Wiki"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' }, + { display: '<img src="/img/sources/josm.16.png" alt="JOSM" title="JOSM"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' }, + // { display: '<img src="/img/sources/potlatch.16.png" alt="Potlatch 2" title="Potlatch 2"/>', name: 'in_potlatch', width: 20, sortable: true, align: 'center' }, + // { display: '<img src="/img/sources/merkaartor.16.png" alt="Merkaartor" title="Merkaartor"/>', name: 'in_merkaartor', width: 20, sortable: true, align: 'center' }, + { display: 'Key', name: 'key', width: 260, sortable: true, align: 'left' }, + { display: 'Wiki Pages', name: 'wikipages', width: 400, sortable: false, align: 'left' } + ], + searchitems: [ + { display: 'Key', name: 'key' } + ], + sortname: 'count_all', + sortorder: 'desc', + height: 420, + preProcess: function(data) { + data.rows = jQuery.map(data.data, function(row, i) { + var wikilinks = []; + jQuery(row.wikipages).each(function(i, wikipage) { + wikilinks.push(print_wiki_link(wikipage.title)); + }); + return { 'cell': [ + row.in_wiki ? '✔' : '-', + row.in_josm ? '✔' : '-', + // row.in_potlatch ? '✔' : '-', + // row.in_merkaartor ? '✔' : '-', + link_to_key(row.key), + wikilinks.join(' • ') + ] }; + }); + return data; + } + }); + }, languages: function() { create_flexigrid('grid-langs', { url: '/api/2/reports/languages', diff --git a/web/views/reports/wiki_pages_about_non_existing_keys.erb b/web/views/reports/wiki_pages_about_non_existing_keys.erb index 72b2197..42c91d2 100644 --- a/web/views/reports/wiki_pages_about_non_existing_keys.erb +++ b/web/views/reports/wiki_pages_about_non_existing_keys.erb @@ -5,51 +5,12 @@ instance in the database. This is not necessarily an error (maybe somebody added the documentation in the wiki as preparation for using a key or the wiki page documents a now obsolete key), but it can also be a typo or other error.</p> -<table id="keys"> +<table id="grid-keys"> </table> -<script type="text/javascript"> - jQuery(document).ready(function() { - jQuery('#keys').flexigrid({ - url: '/api/2/db/keys?filters=in_wiki,not_in_db&include=wikipages', - method: 'GET', - dataType: 'json', - colModel: [ - { display: '<img src="/img/sources/wiki.16.png" alt="Wiki" title="Wiki"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' }, - { display: '<img src="/img/sources/josm.16.png" alt="JOSM" title="JOSM"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' }, - // { display: '<img src="/img/sources/potlatch.16.png" alt="Potlatch 2" title="Potlatch 2"/>', name: 'in_potlatch', width: 20, sortable: true, align: 'center' }, - // { display: '<img src="/img/sources/merkaartor.16.png" alt="Merkaartor" title="Merkaartor"/>', name: 'in_merkaartor', width: 20, sortable: true, align: 'center' }, - { display: 'Key', name: 'key', width: 260, sortable: true, align: 'left' }, - { display: 'Wiki Pages', name: 'wikipages', width: 400, sortable: false, align: 'left' } - ], - searchitems: [ - { display: 'Key', name: 'key' } - ], - sortname: 'count_all', - sortorder: 'desc', - showToggleBtn: false, - usepager: true, - useRp: true, - rp: 15, - rpOptions: [10,15,20,25,50,100], - height: 420, - preProcess: function(data) { - data.rows = jQuery.map(data.data, function(row, i) { - var wikilinks = []; - jQuery(row.wikipages).each(function(i, wikipage) { - wikilinks.push(print_wiki_link(wikipage.title)); - }); - return { 'cell': [ - row.in_wiki ? '✔' : '-', - row.in_josm ? '✔' : '-', - // row.in_potlatch ? '✔' : '-', - // row.in_merkaartor ? '✔' : '-', - link_to_key(row.key), - wikilinks.join(' • ') - ] }; - }); - return data; - } - }); - }); -</script> +<% javascript do + JQuery.ready do + JS.raw(%Q{ create_flexigrid_for.reports.wiki_pages_about_non_existing_keys(); }) + end +end +%> |