WIP: Aureplop/kpsul js refactor #501
6 changed files with 6 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
var cancelHistory = new Event("history_cancel");
|
var cancelHistory = new Event("cancel_done");
|
||||||
|
|
||||||
class KHistory {
|
class KHistory {
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class KHistory {
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel_operations(to_cancel) {
|
cancel_operations(to_cancel) {
|
||||||
var on_success = () => document.dispatchEvent(cancelHistory);
|
var on_success = () => $(this).trigger("cancel_done");
|
||||||
|
|
||||||
api_with_auth({
|
api_with_auth({
|
||||||
url: Urls['kfet.kpsul.cancel_operations'](),
|
url: Urls['kfet.kpsul.cancel_operations'](),
|
||||||
|
|
|
@ -1016,7 +1016,6 @@ class ModelForest {
|
||||||
var child_name = struct_data.children;
|
var child_name = struct_data.children;
|
||||||
if (data.children && data.children.length) {
|
if (data.children && data.children.length) {
|
||||||
for (let child_data of data.children) {
|
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 = this.get_or_create(child_data.modelname, child_data.content, 1);
|
||||||
var child_parent = struct[child_data.modelname];
|
var child_parent = struct[child_data.modelname];
|
||||||
child[child_parent] = node;
|
child[child_parent] = node;
|
||||||
|
|
|
@ -43,7 +43,7 @@ class KPsulManager {
|
||||||
|
|
||||||
_init_events() {
|
_init_events() {
|
||||||
var that = this ;
|
var that = this ;
|
||||||
$(document).on("history_cancel", function(e) {
|
$(this.history).on("cancel_done", function(e) {
|
||||||
that.reset(true);
|
that.reset(true);
|
||||||
that.focus;
|
that.focus;
|
||||||
});
|
});
|
||||||
|
|
|
@ -109,7 +109,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
var khistory = new KHistory({'no_trigramme': true});
|
var khistory = new KHistory({'no_trigramme': true});
|
||||||
|
|
||||||
$(document).on("cancel_history", function(e) {
|
$(khistory).on("cancel_done", function(e) {
|
||||||
khistory.selection.reset();
|
khistory.selection.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ $(document).ready(function() {
|
||||||
updateHistory();
|
updateHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("cancel_history", function(e) {
|
$(khistory).on("cancel_history", function(e) {
|
||||||
khistory.selection.reset();
|
khistory.selection.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
var history = new KHistory();
|
var history = new KHistory();
|
||||||
|
|
||||||
$(document).on("cancel_history", function(e) {
|
$(khistory).on("cancel_done", function(e) {
|
||||||
khistory.selection.reset();
|
khistory.selection.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue