diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/api/reports.rb | 8 | ||||
-rw-r--r-- | web/views/reports/frequently_used_keys_without_wiki_page.erb | 15 |
2 files changed, 17 insertions, 6 deletions
diff --git a/web/lib/api/reports.rb b/web/lib/api/reports.rb index 2044ca3..798f96b 100644 --- a/web/lib/api/reports.rb +++ b/web/lib/api/reports.rb @@ -3,16 +3,20 @@ class Taginfo < Sinatra::Base get '/api/2/reports/frequently_used_keys_without_wiki_page' do + min_count = params[:min_count].to_i || 10000 + + english = (params[:english] == '1') ? '_en' : '' + total = @db.count('db.keys'). condition('count_all > ?', min_count). - condition('in_wiki = 0'). + condition("in_wiki#{english} = 0"). condition_if("key LIKE '%' || ? || '%'", params[:query]). get_first_value().to_i res = @db.select('SELECT * FROM db.keys'). condition('count_all > ?', min_count). - condition('in_wiki = 0'). + condition("in_wiki#{english} = 0"). condition_if("key LIKE '%' || ? || '%'", params[:query]). order_by([:key, :count_all, :values_all, :users_all], params[:sortname], params[:sortorder]). paging(params[:rp], params[:page]). diff --git a/web/views/reports/frequently_used_keys_without_wiki_page.erb b/web/views/reports/frequently_used_keys_without_wiki_page.erb index d915dcf..f4c59ba 100644 --- a/web/views/reports/frequently_used_keys_without_wiki_page.erb +++ b/web/views/reports/frequently_used_keys_without_wiki_page.erb @@ -8,8 +8,8 @@ redirect to a different wiki page instead. To do this put just one line with <tt style="background-color: #f0f0f0; padding: 0 2px;">#REDIRECT [[<i>page name</i>]]</tt> in the wiki page.</p> -<form> - <input type="checkbox" name="english" id="english" value="0"/> Also show keys that have no English language wiki page but a page in some other language. +<form method="" type="GET"> + <input type="checkbox" name="english" id="english"<%= params[:english] == '1' ? ' checked="checked"' : '' %>/> Also show keys that have no English language wiki page but a page in some other language. </form> <p></p> @@ -17,9 +17,10 @@ in the wiki page.</p> </table> <script type="text/javascript"> +var grid; jQuery(document).ready(function() { - jQuery('#keys').flexigrid({ - url: '/api/2/reports/frequently_used_keys_without_wiki_page', + grid = jQuery('#keys').flexigrid({ + url: '/api/2/reports/frequently_used_keys_without_wiki_page?english=' + <%= params[:english] == '1' ? '1' : '0' %>, method: 'GET', dataType: 'json', colModel: [ @@ -55,5 +56,11 @@ in the wiki page.</p> return data; } }); + jQuery('#english').bind('click', function() { + jQuery('#keys').flexOptions({ + url: '/api/2/reports/frequently_used_keys_without_wiki_page?english=' + (jQuery('#english')[0].checked ? '1' : '0') + }); + jQuery('#keys').flexReload(); + }); }); </script> |