Commit 1069ec37 authored by HERBERT Ryan's avatar HERBERT Ryan Committed by Vidjil Team

builder.js Refactoring create_save_button

Applying the same principle to create_save_button.
Matching the prototype with the desired usage put in place in 974bb904e0
Passing the onclick function as a parameter allows for greater diversity
as this is the point in which most usages differ in the present case
parent b5c4f4a8
......@@ -256,22 +256,22 @@ Builder.prototype = {
return input;
},
create_save_button: function (target_id, data) {
var self = this;
create_save_button: function (target_id, data, save_callback) {
var a = document.createElement('a');
a.className = "button";
a.appendChild(document.createTextNode("save"));
a.id = "btnSave";
a.onclick = function () {
self.m.samples[data][self.m.t] = document.getElementById(target_id).value
self.build_top_container()
self.build_info_container()
self.m.update()
self.m.analysisHasChanged = true
}
a.onclick = save_callback;
return a;
},
post_save: function(self, data) {
self.build_top_container()
self.build_info_container()
self.m.update()
self.m.analysisHasChanged = true
},
/*complete displaySelector menu with correct info about current tagname / top
* */
build_displaySelector: function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment