|
|
|
@ -10,7 +10,7 @@ export class TemplateEngine { |
|
|
|
|
$('body').html(reponse); |
|
|
|
|
this.get_template((reponse) => { |
|
|
|
|
$("#block-content").html(reponse); |
|
|
|
|
if (this.after_render_callback) this.after_render_callback(this); |
|
|
|
|
if (this.after_render_callback) this.#flush_events().after_render_callback(this); |
|
|
|
|
}, template) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -24,7 +24,6 @@ export class TemplateEngine { |
|
|
|
|
get_template(callback, template = "") { |
|
|
|
|
let url = template === "" ? `${this.templatePath}/template.html`: `${this.templatePath}/${template}`; |
|
|
|
|
$.ajax(url,{ |
|
|
|
|
async: false, |
|
|
|
|
method: "GET", |
|
|
|
|
success: callback, |
|
|
|
|
error: (err) => { |
|
|
|
@ -37,6 +36,11 @@ export class TemplateEngine { |
|
|
|
|
$("body").on(action, tag, callback); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#flush_events() { |
|
|
|
|
$("body").unbind(); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
after_render(callback) { |
|
|
|
|
this.after_render_callback = callback; |
|
|
|
|
} |
|
|
|
|