diff options
author | Jochen Topf <jochen@topf.org> | 2012-01-23 20:15:56 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2012-01-23 20:15:56 +0100 |
commit | a4ad712062678203d1a02ecf21f89848cc98c8c7 (patch) | |
tree | 21d9b885d8adcf89d5efdd59b9e310357fadc16b /web | |
parent | 879076c025394ff3c9fda5455d642fca18be83a6 (diff) | |
download | taginfo-a4ad712062678203d1a02ecf21f89848cc98c8c7.tar taginfo-a4ad712062678203d1a02ecf21f89848cc98c8c7.tar.gz |
Add missing .js file
Diffstat (limited to 'web')
-rw-r--r-- | web/viewsjs/reports/language_comparison_table_for_keys_in_the_wiki.js.erb | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/web/viewsjs/reports/language_comparison_table_for_keys_in_the_wiki.js.erb b/web/viewsjs/reports/language_comparison_table_for_keys_in_the_wiki.js.erb new file mode 100644 index 0000000..6f47047 --- /dev/null +++ b/web/viewsjs/reports/language_comparison_table_for_keys_in_the_wiki.js.erb @@ -0,0 +1,57 @@ +<% + @languages = @db.execute('SELECT language FROM wiki_languages ORDER by language').map do |row| + row['language'] + end + + lang_lookup = Hash.new + @languages.each_with_index do |lang, idx| + lang_lookup[lang] = idx + 1 + end + @languages_lookup = @languages.map{ |lang| "'#{lang}': #{lang_lookup[lang]}" }.join(', ') +%> +function page_init() { + var lang_to_idx = { + <%= @languages_lookup %> + }; + var rp = calculate_flexigrid_rp(jQuery('div.box')) - 1; + current_grid = 'grid-keys'; + grids[current_grid] = jQuery('#grid-keys').flexigrid({ + url: '/api/2/wiki/keys', + method: 'GET', + dataType: 'json', + colModel: [ + { display: '<br/>Key', name: 'key', width: 200, sortable: true }, + <% @languages.each do |lang| %> + { display: '<%= ::Language[lang].native_name %><br /><span class="lang" style="margin-top: 2px;"><%= lang %></span>', name: '<%= lang %>', align: 'center', width: 60, sortable: false }, + <% end %> + ], + searchitems: [ + { display: 'Key', name: 'key' } + ], + sortname: 'key', + sortorder: 'asc', + showToggleBtn: false, + showTableToggleBtn: false, + usepager: true, + useRp: false, + rp: rp, + height: 'auto', + onSuccess: function(grid) { + grid.fixHeight(); + }, + preProcess: function(data) { + return { + total: data.total, + page: data.page, + rows: jQuery.map(data.data, function(row, i) { + d = [link_to_key(row.key) <%= @languages.map{ ", ''"}.join() %>]; + for (var lang in row.lang) { + ptype = row.lang[lang]; + d[lang_to_idx[lang]] = '<img src="/img/sources/wiki/wiki-' + ptype + '.png" alt="[' + ptype + ']"/>'; + } + return { 'cell': d }; + }) + }; + } + }); +} |