Show version and tag it correctly. Fixes #502 and fixes #499

This commit is contained in:
Tom MacWright
2013-01-25 12:00:23 -05:00
parent da41235b94
commit 9116978609
3 changed files with 22 additions and 9 deletions
+12 -1
View File
@@ -4,6 +4,7 @@ iD.Connection = function() {
url = 'http://www.openstreetmap.org',
connection = {},
user = {},
version,
keys,
inflight = {},
loadedTiles = {},
@@ -186,7 +187,11 @@ iD.Connection = function() {
method: 'PUT',
path: '/api/0.6/changeset/create',
options: { header: { 'Content-Type': 'text/xml' } },
content: iD.format.XML.changeset(comment, imagery_used)
content: iD.format.XML.changeset({
imagery_used: imagery_used.join(';'),
comment: comment,
created_by: 'iD ' + (version || '')
})
}, function (err, changeset_id) {
if (err) return callback(err);
oauth.xhr({
@@ -321,6 +326,12 @@ iD.Connection = function() {
return oauth.authenticate(done);
};
connection.version = function(_) {
if (!arguments.length) return version;
version = _;
return connection;
};
connection.bboxFromAPI = bboxFromAPI;
connection.loadFromURL = loadFromURL;
connection.loadTiles = _.debounce(loadTiles, 100);
+4 -6
View File
@@ -15,16 +15,14 @@ iD.format.XML = {
return s.replace(/>/g,'&gt;').replace(/</g,'&lt;').replace(/"/g,'&quot;');
},
// Generate Changeset XML. Returns a string.
changeset: function(comment, imagery_used) {
changeset: function(tags) {
return (new XMLSerializer()).serializeToString(
JXON.unbuild({
osm: {
changeset: {
tag: [
{ '@k': 'created_by', '@v': 'iD 0.0.0' },
{ '@k': 'comment', '@v': comment || '' },
{ '@k': 'imagery_used', '@v': imagery_used.join(';')}
],
tag: _.map(tags, function(value, key) {
return { '@k': key, '@v': value };
}),
'@version': 0.3,
'@generator': 'iD'
}
+6 -2
View File
@@ -1,5 +1,9 @@
window.iD = function(container) {
var connection = iD.Connection(),
// the reported, displayed version of iD.
var version = '0.0.0-alpha1';
var connection = iD.Connection()
.version(version),
history = iD.History(),
map = iD.Map()
.connection(connection)
@@ -142,7 +146,7 @@ window.iD = function(container) {
.attr('id','about')
.attr('class','pad1 fillD about-block link-list');
linkList.append('li').append('a').attr('target', '_blank')
.attr('href', 'http://github.com/systemed/iD').text('view code');
.attr('href', 'http://github.com/systemed/iD').text(version);
linkList.append('li').append('a').attr('target', '_blank')
.attr('href', 'http://github.com/systemed/iD/issues').text('report a bug');