mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-26 23:43:46 +00:00
Add success page. Fixes #126
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
<script src='js/id/ui/modal.js'></script>
|
||||
<script src='js/id/ui/confirm.js'></script>
|
||||
<script src='js/id/ui/commit.js'></script>
|
||||
<script src='js/id/ui/success.js'></script>
|
||||
<script src='js/id/ui/loading.js'></script>
|
||||
<script src='js/id/ui/userpanel.js'></script>
|
||||
<script src='js/id/ui/layerswitcher.js'></script>
|
||||
|
||||
11
js/id/id.js
11
js/id/id.js
@@ -121,6 +121,17 @@ window.iD = function(container) {
|
||||
l.remove();
|
||||
history.reset();
|
||||
map.flush().redraw();
|
||||
var modal = iD.modal();
|
||||
modal.select('.content')
|
||||
.classed('success-modal', true)
|
||||
.datum({
|
||||
id: changeset_id,
|
||||
comment: e.comment
|
||||
})
|
||||
.call(iD.success()
|
||||
.on('cancel', function() {
|
||||
modal.remove();
|
||||
}));
|
||||
});
|
||||
}
|
||||
var changes = history.changes();
|
||||
|
||||
43
js/id/ui/success.js
Normal file
43
js/id/ui/success.js
Normal file
@@ -0,0 +1,43 @@
|
||||
iD.success = function() {
|
||||
var event = d3.dispatch('cancel', 'save');
|
||||
|
||||
function success(selection) {
|
||||
var changeset = selection.datum(),
|
||||
header = selection.append('div').attr('class', 'header modal-section'),
|
||||
body = selection.append('div').attr('class', 'body');
|
||||
|
||||
var section = body.append('div').attr('class','modal-section');
|
||||
|
||||
header.append('h2').text('You Just Edited OpenStreetMap!');
|
||||
header.append('p').text('You just improved the world\'s best free map');
|
||||
|
||||
var m = '';
|
||||
if (changeset.comment) {
|
||||
m = '"' + changeset.comment.substring(0, 20) + '" ';
|
||||
}
|
||||
|
||||
var message = 'Edited OpenStreetMap! ' + m +
|
||||
'http://osm.org/browse/changeset/' + changeset.id;
|
||||
|
||||
section.append('a')
|
||||
.attr('href', function(d) {
|
||||
return 'https://twitter.com/intent/tweet?source=webclient&text=' +
|
||||
encodeURIComponent(message);
|
||||
})
|
||||
.text('Tweet: ' + message);
|
||||
|
||||
var buttonwrap = section.append('div')
|
||||
.attr('class', 'buttons');
|
||||
|
||||
var okbutton = buttonwrap.append('button')
|
||||
.attr('class', 'action wide')
|
||||
.on('click.save', function() {
|
||||
event.cancel();
|
||||
});
|
||||
|
||||
okbutton.append('span').attr('class','icon apply icon-pre-text');
|
||||
okbutton.append('span').attr('class','label').text('OK');
|
||||
}
|
||||
|
||||
return d3.rebind(success, event, 'on');
|
||||
};
|
||||
Reference in New Issue
Block a user