From 97bc2429dc422ec0425d61fb248f397519967620 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 8 Jan 2013 16:26:28 -0500 Subject: [PATCH] Update background source for history --- js/id/connection.js | 2 +- js/id/graph/history.js | 10 ++++++---- js/id/ui/layerswitcher.js | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/id/connection.js b/js/id/connection.js index 4e9c90eba..3e7857da7 100644 --- a/js/id/connection.js +++ b/js/id/connection.js @@ -108,7 +108,7 @@ iD.Connection = function() { method: 'PUT', path: '/api/0.6/changeset/create', options: { header: { 'Content-Type': 'text/xml' } }, - content: iD.format.XML.changeset(comment) + content: iD.format.XML.changeset(comment, imagery_used) }, function (err, changeset_id) { if (err) return callback(err); oauth.xhr({ diff --git a/js/id/graph/history.js b/js/id/graph/history.js index 08a3875a3..e31fa5ef9 100644 --- a/js/id/graph/history.js +++ b/js/id/graph/history.js @@ -1,5 +1,6 @@ iD.History = function() { - var stack, index, imagery_used, + var stack, index, + imagery_used = 'Bing', dispatch = d3.dispatch('change'); function perform(actions) { @@ -16,8 +17,6 @@ iD.History = function() { graph = actions[i](graph); } - imagery_used = 'Bing'; // TODO, un-hardcode - return {graph: graph, annotation: annotation, imagery_used: imagery_used}; } @@ -111,7 +110,10 @@ iD.History = function() { }, imagery_used: function(source) { - return _.unique(_.pluck(stack.slice(1, index + 1), 'imagery_used')); + if (source) imagery_used = source; + else return _.without( + _.unique(_.pluck(stack.slice(1, index + 1), 'imagery_used')), + undefined, 'Custom'); }, reset: function () { diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index 832ea15f4..e8a62c0bb 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -126,6 +126,7 @@ iD.layerswitcher = function(map) { d.name = 'Custom (configured)'; } map.background.source(d.source); + map.history().imagery_used(d.name); map.redraw(); selectLayer(d); })