forked from DGNum/gestioCOF
Remove kpsul dependence from history (oops)
This commit is contained in:
parent
644b08973a
commit
9e905b0f8b
1 changed files with 16 additions and 6 deletions
|
@ -18,6 +18,7 @@ class History {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.display_options = {} ;
|
this.display_options = {} ;
|
||||||
|
this.lock = 0 ;
|
||||||
|
|
||||||
this._init_selection();
|
this._init_selection();
|
||||||
this._init_events();
|
this._init_events();
|
||||||
|
@ -70,9 +71,18 @@ class History {
|
||||||
|
|
||||||
//TODO: permission management in another class ?
|
//TODO: permission management in another class ?
|
||||||
cancel_operations(to_cancel, password='') {
|
cancel_operations(to_cancel, password='') {
|
||||||
if (kpsul.lock == 1)
|
if (this.lock == 1)
|
||||||
return false;
|
return false;
|
||||||
kpsul.lock = 1;
|
this.lock = 1;
|
||||||
|
|
||||||
|
if (window.kpsul) {
|
||||||
|
var on_success = kpsul.env.coolReset;
|
||||||
|
var focus_next = kpsul.account_manager._$input_trigramme;
|
||||||
|
} else {
|
||||||
|
var on_success = () => this._$container.find('.ui-selected')
|
||||||
|
.removeClass('.ui-selected) ;
|
||||||
|
var focus_next = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
var data = { 'operations': to_cancel };
|
var data = { 'operations': to_cancel };
|
||||||
|
|
||||||
|
@ -88,8 +98,8 @@ class History {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
kpsul._env.coolReset();
|
on_success();
|
||||||
kpsul.lock = 0;
|
this.lock = 0;
|
||||||
})
|
})
|
||||||
.fail(function($xhr) {
|
.fail(function($xhr) {
|
||||||
var data = $xhr.responseJSON;
|
var data = $xhr.responseJSON;
|
||||||
|
@ -97,13 +107,13 @@ class History {
|
||||||
case 403:
|
case 403:
|
||||||
requestAuth(data, function(password) {
|
requestAuth(data, function(password) {
|
||||||
cancelOperations(to_cancel, password);
|
cancelOperations(to_cancel, password);
|
||||||
}, kpsul.account_manager._$input_trigramme);
|
}, focus_next);
|
||||||
break;
|
break;
|
||||||
case 400:
|
case 400:
|
||||||
displayErrors(getErrorsHtml(data));
|
displayErrors(getErrorsHtml(data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
kpsul.lock = 0;
|
this.lock = 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue