diff options
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/api/test/langtag.rb | 8 | ||||
-rw-r--r-- | web/lib/api/v4/key.rb | 4 | ||||
-rw-r--r-- | web/lib/api/v4/keys.rb | 8 | ||||
-rw-r--r-- | web/lib/api/v4/project.rb | 2 | ||||
-rw-r--r-- | web/lib/api/v4/site.rb | 2 | ||||
-rw-r--r-- | web/lib/javascript.rb | 2 | ||||
-rw-r--r-- | web/lib/sql.rb | 2 | ||||
-rw-r--r-- | web/lib/ui/keys.rb | 2 | ||||
-rw-r--r-- | web/lib/ui/search.rb | 2 | ||||
-rw-r--r-- | web/lib/ui/taginfo.rb | 6 |
10 files changed, 19 insertions, 19 deletions
diff --git a/web/lib/api/test/langtag.rb b/web/lib/api/test/langtag.rb index 8fbc998..4268bd8 100644 --- a/web/lib/api/test/langtag.rb +++ b/web/lib/api/test/langtag.rb @@ -7,7 +7,7 @@ class Taginfo < Sinatra::Base :paging => :optional, :sort => %w( key count_all ), :result => { - :key => :STRING, + :key => :STRING, :count_all => :INT, :in_wiki => :BOOL, :prefix => :STRING, @@ -31,7 +31,7 @@ class Taginfo < Sinatra::Base condition("key LIKE '%name%'"). condition_if("key LIKE '%' || ? || '%'", params[:query]). get_first_value().to_i - + res = @db.select('SELECT * FROM db.keys'). condition("key LIKE '%name%'"). condition_if("key LIKE '%' || ? || '%'", params[:query]). @@ -66,7 +66,7 @@ class Taginfo < Sinatra::Base :region_state => nt.region_state, :region_note => nt.region_note, :notes => nt.notes - }} + }} }, json_opts(params[:format])) end @@ -117,7 +117,7 @@ class Taginfo < Sinatra::Base notes = '' if row['suppress_script'] notes += "Default script: #{ row['suppress_script'] }" - end + end unless row['prefix'].empty? notes += "Prefixes: #{ row['prefix'] }" end diff --git a/web/lib/api/v4/key.rb b/web/lib/api/v4/key.rb index c88092a..813af1d 100644 --- a/web/lib/api/v4/key.rb +++ b/web/lib/api/v4/key.rb @@ -45,7 +45,7 @@ class Taginfo < Sinatra::Base res = (params[:query].to_s != '' ? @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.key_combinations p, db.keys k WHERE p.key1=k.key AND p.key2=? AND (p.key1 LIKE ? ESCAPE '@') AND p.count_#{filter_type} > 0 UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.key_combinations p, db.keys k WHERE p.key2=k.key AND p.key1=? AND (p.key2 LIKE ? ESCAPE '@') AND p.count_#{filter_type} > 0", key, like_contains(params[:query]), key, like_contains(params[:query])) : - @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.key_combinations p, db.keys k WHERE p.key1=k.key AND p.key2=? AND p.count_#{filter_type} > 0 + @db.select("SELECT p.key1 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.key_combinations p, db.keys k WHERE p.key1=k.key AND p.key2=? AND p.count_#{filter_type} > 0 UNION SELECT p.key2 AS other_key, p.count_#{filter_type} AS together_count, k.count_#{filter_type} AS other_count, CAST(p.count_#{filter_type} AS REAL) / k.count_#{filter_type} AS from_fraction FROM db.key_combinations p, db.keys k WHERE p.key2=k.key AND p.key1=? AND p.count_#{filter_type} > 0", key, key)). order_by(@ap.sortname, @ap.sortorder) { |o| o.together_count @@ -129,7 +129,7 @@ class Taginfo < Sinatra::Base }) do style = params[:style] key = params[:key] - + total = @db.count('josm_style_rules'). # condition('style = ?', style). condition('k = ?', key). diff --git a/web/lib/api/v4/keys.rb b/web/lib/api/v4/keys.rb index 723efe0..b183660 100644 --- a/web/lib/api/v4/keys.rb +++ b/web/lib/api/v4/keys.rb @@ -50,7 +50,7 @@ class Taginfo < Sinatra::Base condition_if("key LIKE ? ESCAPE '@'", like_contains(params[:query])). conditions(filters). get_first_value().to_i - + res = @db.select('SELECT * FROM db.keys'). condition_if("key LIKE ? ESCAPE '@'", like_contains(params[:query])). conditions(filters). @@ -137,7 +137,7 @@ class Taginfo < Sinatra::Base :users_all => row['users_all'].to_i, :in_wiki => row['in_wiki'].to_i == 1 ? true : false, :in_josm => false - } + } h[:wikipages] = row['wikipages'] if row['wikipages'] h[:prevalent_values] = row['prevalent_values'][0,10] if row['prevalent_values'] h } @@ -150,7 +150,7 @@ class Taginfo < Sinatra::Base :paging => :optional, :sort => %w( key ), :result => paging_results([ - [:key, :STRING, 'Key'], + [:key, :STRING, 'Key'], [:lang, :HASH, 'Hash with language codes as keys and values showing what type of wiki pages are available.'] ]), :example => { :page => 1, :rp => 10, :sortname => 'key', :sortorder => 'asc' }, @@ -225,7 +225,7 @@ class Taginfo < Sinatra::Base condition("in_wiki#{english} = 0"). condition_if("key LIKE ? ESCAPE '@'", like_contains(params[:query])). get_first_value().to_i - + res = @db.select('SELECT * FROM db.keys'). condition('count_all > ?', min_count). condition("in_wiki#{english} = 0"). diff --git a/web/lib/api/v4/project.rb b/web/lib/api/v4/project.rb index 50e1753..986f14b 100644 --- a/web/lib/api/v4/project.rb +++ b/web/lib/api/v4/project.rb @@ -27,7 +27,7 @@ class Taginfo < Sinatra::Base condition("project_id=?", project_id). condition_if("key LIKE ? ESCAPE '@' OR value LIKE ? ESCAPE '@'", q, q). get_first_value().to_i - + res = @db.select('SELECT * FROM projects.project_tags'). condition("project_id=?", project_id). condition_if("key LIKE ? ESCAPE '@' OR value LIKE ? ESCAPE '@'", q, q). diff --git a/web/lib/api/v4/site.rb b/web/lib/api/v4/site.rb index 6c7a24e..2b29f09 100644 --- a/web/lib/api/v4/site.rb +++ b/web/lib/api/v4/site.rb @@ -15,7 +15,7 @@ class Taginfo < Sinatra::Base }) do data = {} [:url, :name, :description, :icon, :contact, :area].each do |k| - data[k] = TaginfoConfig.get("instance.#{k}") + data[k] = TaginfoConfig.get("instance.#{k}") end return JSON.generate(data, json_opts(params[:format])) end diff --git a/web/lib/javascript.rb b/web/lib/javascript.rb index 9616445..ff9f178 100644 --- a/web/lib/javascript.rb +++ b/web/lib/javascript.rb @@ -59,7 +59,7 @@ class JQuery # "include" the convenience methods from R18n::Helpers. # Uses extend instead of include, because we want this # to work not with instances of JQuery but they should - # show up as JQuery class methods. + # show up as JQuery class methods. extend R18n::Helpers def self.flexigrid(id, options) diff --git a/web/lib/sql.rb b/web/lib/sql.rb index 39c1ff1..2845858 100644 --- a/web/lib/sql.rb +++ b/web/lib/sql.rb @@ -227,7 +227,7 @@ module SQL def to_s(direction) dir = @reverse ? @@DIRECTION[direction.upcase] : direction.upcase - "#{@column} #{dir}" + "#{@column} #{dir}" end end diff --git a/web/lib/ui/keys.rb b/web/lib/ui/keys.rb index 1d6747b..ec5210c 100644 --- a/web/lib/ui/keys.rb +++ b/web/lib/ui/keys.rb @@ -48,7 +48,7 @@ class Taginfo < Sinatra::Base @josm_count = @db.count('josm_style_rules').condition('k = ?', @key).get_first_i @wiki_count = @db.count('wiki.wikipages').condition('key=? AND value IS NULL', @key).get_first_i @user_count = @db.select('SELECT users_all FROM db.keys').condition('key=?', @key).get_first_i - + @img_width = TaginfoConfig.get('geodistribution.width') * TaginfoConfig.get('geodistribution.scale_image') @img_height = TaginfoConfig.get('geodistribution.height') * TaginfoConfig.get('geodistribution.scale_image') diff --git a/web/lib/ui/search.rb b/web/lib/ui/search.rb index 1c6a71c..8c72215 100644 --- a/web/lib/ui/search.rb +++ b/web/lib/ui/search.rb @@ -17,7 +17,7 @@ class Taginfo < Sinatra::Base # Return opensearch description (see www.opensearch.org) get '/search/opensearch.xml' do - content_type :opensearch + content_type :opensearch opensearch = <<END_XML <?xml version="1.0" encoding="UTF-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb index de7b07e..8c9e85a 100644 --- a/web/lib/ui/taginfo.rb +++ b/web/lib/ui/taginfo.rb @@ -28,7 +28,7 @@ class Taginfo < Sinatra::Base out += line.call(level, key, name, en[key], '<span style="color: red;">MISSING</span>') else out += line.call(level, key, name, en[key], other[key]) - end + end end end out @@ -98,10 +98,10 @@ class Taginfo < Sinatra::Base @i18n_lang = YAML.load_file("i18n/#{@lang}.yml") rescue @error = "Unknown language: #{@lang}" - end + end c = 'even' - @line = lambda { |level, key, name, en, other| + @line = lambda { |level, key, name, en, other| c = (c == '') ? 'even': '' "<tr><td class='#{c}' style='padding-left: #{ level * 16 + 6 }px;'><span title='#{ name }'>#{ key }</span></td><td class='#{c}'>#{ en }</td><td class='#{c}'>#{ other }</td></tr>" } |