diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-06 16:58:43 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-06 16:58:43 +0100 |
commit | 395b80de72ce59c42135e9e68579ae1ee039f79a (patch) | |
tree | 25ff58266c69915e887797ce227fee9d0a9f2f20 /web/lib/utils.rb | |
parent | 465a86c863ce81d77079240d33a48d9520182e92 (diff) | |
download | taginfo-395b80de72ce59c42135e9e68579ae1ee039f79a.tar taginfo-395b80de72ce59c42135e9e68579ae1ee039f79a.tar.gz |
Updated josm API calls
Diffstat (limited to 'web/lib/utils.rb')
-rw-r--r-- | web/lib/utils.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/lib/utils.rb b/web/lib/utils.rb index c30ff04..384e9c6 100644 --- a/web/lib/utils.rb +++ b/web/lib/utils.rb @@ -196,3 +196,22 @@ def get_wiki_result(res) }.to_json end +# Used in josm api calls +def get_josm_style_rules_result(total, res) + return { + :page => @ap.page, + :rp => @ap.results_per_page, + :total => total, + :data => res.map{ |row| { + :key => row['k'], + :value => row['v'], + :b => row['b'], + :rule => h(row['rule']), + :area_color => row['area_color'] ? h(row['area_color'].sub(/^.*#/, '#')) : '', + :line_color => row['line_color'] ? h(row['line_color'].sub(/^.*#/, '#')) : '', + :line_width => row['line_width'] ? row['line_width'].to_i : 0, + :icon => row['icon_source'] && row['icon_source'] != 'misc/deprecated.png' && row['icon_source'] != 'misc/no_icon.png' ? h(row['icon_source']) : '' + } } + }.to_json +end + |