mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 01:33:03 +00:00
Fix Loading
This commit is contained in:
@@ -33,12 +33,15 @@ iD.Connection = function(context) {
|
||||
};
|
||||
|
||||
function authLoading() {
|
||||
loadingModal = iD.ui.loading(context.container(),
|
||||
t('loading_auth'));
|
||||
loadingModal = iD.ui.Loading(context)
|
||||
.message(t('loading_auth'));
|
||||
|
||||
context.container()
|
||||
.call(loadingModal);
|
||||
}
|
||||
|
||||
function authDone() {
|
||||
if (loadingModal) loadingModal.remove();
|
||||
if (loadingModal) loadingModal.close();
|
||||
}
|
||||
|
||||
function getNodes(obj) {
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
iD.ui.loading = function(selection, message, blocking) {
|
||||
var modal = iD.ui.modal(selection, blocking);
|
||||
iD.ui.Loading = function(context) {
|
||||
var message = '',
|
||||
blocking = false,
|
||||
modal;
|
||||
|
||||
var loadertext = modal.select('.content')
|
||||
.classed('loading-modal', true)
|
||||
.append('div')
|
||||
.attr('class', 'modal-section fillL');
|
||||
var loading = function(selection) {
|
||||
modal = iD.ui.modal(selection, blocking);
|
||||
|
||||
loadertext.append('img')
|
||||
.attr('class', 'loader')
|
||||
.attr('src', context.imagePath('loader-white.gif'));
|
||||
var loadertext = modal.select('.content')
|
||||
.classed('loading-modal', true)
|
||||
.append('div')
|
||||
.attr('class', 'modal-section fillL');
|
||||
|
||||
loadertext.append('h3')
|
||||
.text(message || '');
|
||||
loadertext.append('img')
|
||||
.attr('class', 'loader')
|
||||
.attr('src', context.imagePath('loader-white.gif'));
|
||||
|
||||
modal.select('button.close')
|
||||
.attr('class', 'hide');
|
||||
loadertext.append('h3')
|
||||
.text(message);
|
||||
|
||||
return modal;
|
||||
modal.select('button.close')
|
||||
.attr('class', 'hide');
|
||||
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.message = function(_) {
|
||||
if (!arguments.length) return message;
|
||||
message = _;
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.blocking = function(_) {
|
||||
if (!arguments.length) return blocking;
|
||||
blocking = _;
|
||||
return loading;
|
||||
};
|
||||
|
||||
loading.close = function() {
|
||||
modal.remove();
|
||||
};
|
||||
|
||||
return loading;
|
||||
};
|
||||
|
||||
@@ -30,14 +30,19 @@ iD.ui.Save = function(context) {
|
||||
context.container().select('.shaded')
|
||||
.remove();
|
||||
|
||||
var loading = iD.ui.loading(context.container(), t('save.uploading'), true);
|
||||
var loading = iD.ui.Loading(context)
|
||||
.message(t('save.uploading'))
|
||||
.blocking(true);
|
||||
|
||||
context.container()
|
||||
.call(loading);
|
||||
|
||||
connection.putChangeset(
|
||||
history.changes(),
|
||||
e.comment,
|
||||
history.imagery_used(),
|
||||
function(err, changeset_id) {
|
||||
loading.remove();
|
||||
loading.close();
|
||||
if (err) {
|
||||
var confirm = iD.ui.confirm(context.container());
|
||||
confirm
|
||||
|
||||
Reference in New Issue
Block a user