summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-05-18 10:48:23 +0200
committerJochen Topf <jochen@topf.org>2014-05-18 10:48:23 +0200
commit24eb90c44c77efea8309e6196de0d2a26ad142df (patch)
tree65a9c3d7e422f54b191794fab91908bbdced86e7 /web
parent29cab582a7049c9bc286db5a1f91992780a445a1 (diff)
downloadtaginfo-24eb90c44c77efea8309e6196de0d2a26ad142df.tar
taginfo-24eb90c44c77efea8309e6196de0d2a26ad142df.tar.gz
Set comparison list in cookie when /compare page is called.
Diffstat (limited to 'web')
-rw-r--r--web/lib/ui/compare.rb1
-rw-r--r--web/views/compare.erb6
2 files changed, 7 insertions, 0 deletions
diff --git a/web/lib/ui/compare.rb b/web/lib/ui/compare.rb
index 4c08741..f2c578f 100644
--- a/web/lib/ui/compare.rb
+++ b/web/lib/ui/compare.rb
@@ -66,6 +66,7 @@ class Taginfo < Sinatra::Base
@img_width = TaginfoConfig.get('geodistribution.width')
@img_height = TaginfoConfig.get('geodistribution.height')
+ javascript_for(:cookie)
javascript "#{ r18n.locale.code }/compare"
erb :compare
end
diff --git a/web/views/compare.erb b/web/views/compare.erb
index e972b3d..dd2e622 100644
--- a/web/views/compare.erb
+++ b/web/views/compare.erb
@@ -86,6 +86,12 @@
JS.raw(<<"JAVASCRIPT")
function page_init2() {
var data = #{ @data.to_json };
+ jQuery.cookie.json = true;
+ var items = []
+ jQuery.each(data, function(index, item) {
+ items.push([ item.key, (item.value === null ? undefined : item.value) ]);
+ });
+ set_comparison_list(items);
jQuery.each(data, function(index, item) {
var datac = [];
jQuery.each(data, function(i, item) {