Remove kpsul dependence from history (oops)

This commit is contained in:
Ludovic Stephan 2017-03-18 02:40:34 -03:00
parent 644b08973a
commit 9e905b0f8b

View file

@ -18,6 +18,7 @@ class History {
};
this.display_options = {} ;
this.lock = 0 ;
this._init_selection();
this._init_events();
@ -70,9 +71,18 @@ class History {
//TODO: permission management in another class ?
cancel_operations(to_cancel, password='') {
if (kpsul.lock == 1)
if (this.lock == 1)
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 };
@ -88,8 +98,8 @@ class History {
},
})
.done(function(data) {
kpsul._env.coolReset();
kpsul.lock = 0;
on_success();
this.lock = 0;
})
.fail(function($xhr) {
var data = $xhr.responseJSON;
@ -97,13 +107,13 @@ class History {
case 403:
requestAuth(data, function(password) {
cancelOperations(to_cancel, password);
}, kpsul.account_manager._$input_trigramme);
}, focus_next);
break;
case 400:
displayErrors(getErrorsHtml(data));
break;
}
kpsul.lock = 0;
this.lock = 0;
});
}