Trigger event on history itself

This commit is contained in:
Ludovic Stephan 2017-04-10 15:40:29 -03:00
parent 2eba6892a2
commit 8c02e5da0c
6 changed files with 6 additions and 7 deletions

View file

@ -1,4 +1,4 @@
var cancelHistory = new Event("history_cancel");
var cancelHistory = new Event("cancel_done");
class KHistory {
@ -72,7 +72,7 @@ class KHistory {
}
cancel_operations(to_cancel) {
var on_success = () => document.dispatchEvent(cancelHistory);
var on_success = () => $(this).trigger("cancel_done");
api_with_auth({
url: Urls['kfet.kpsul.cancel_operations'](),

View file

@ -1016,7 +1016,6 @@ class ModelForest {
var child_name = struct_data.children;
if (data.children && data.children.length) {
for (let child_data of data.children) {
console.log(child_data);
var child = this.get_or_create(child_data.modelname, child_data.content, 1);
var child_parent = struct[child_data.modelname];
child[child_parent] = node;

View file

@ -43,7 +43,7 @@ class KPsulManager {
_init_events() {
var that = this ;
$(document).on("history_cancel", function(e) {
$(this.history).on("cancel_done", function(e) {
that.reset(true);
that.focus;
});

View file

@ -109,7 +109,7 @@ $(document).ready(function() {
var khistory = new KHistory({'no_trigramme': true});
$(document).on("cancel_history", function(e) {
$(khistory).on("cancel_done", function(e) {
khistory.selection.reset();
});

View file

@ -129,7 +129,7 @@ $(document).ready(function() {
updateHistory();
});
$(document).on("cancel_history", function(e) {
$(khistory).on("cancel_history", function(e) {
khistory.selection.reset();
});

View file

@ -53,7 +53,7 @@ $(document).ready(function() {
var history = new KHistory();
$(document).on("cancel_history", function(e) {
$(khistory).on("cancel_done", function(e) {
khistory.selection.reset();
});