Skip to content
Snippets Groups Projects
Commit 59939829 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

FIX: Don't add file-upload button to new properties immediatly

parent 96078417
No related branches found
No related tags found
2 merge requests!142REL: Release 0.15.0,!141F lazy edit mode dropdowns
Pipeline #55519 passed
......@@ -261,24 +261,29 @@ var fileupload = new function() {
}
this.init = function() {
if ("${BUILD_EDIT_MODE_LAZY_DROPDOWN_LOADING}" == "ENABLED") {
if ("${BUILD_EDIT_MODE_LAZY_DROPDOWN_LOADING}" == "ENABLED") {
// If we have to manually enable editting of reference
// properties, we only want to add the file-upload button
// **after** we started editing the particular
// property. So no global event listener and not
// immediatly after adding a new reference property.
document.body.addEventListener(edit_mode.property_edit_reference_value.type, function(e) {
fileupload.create_upload_app(e.target);
}, true);
} else {
// add global listener for start_edit event
fileupload.create_upload_app(e.target);
}, true);
} else {
// add global listener for start_edit event
document.body.addEventListener(edit_mode.start_edit.type, function(e) {
$(e.target).find(".caosdb-properties .caosdb-f-entity-property").each(function(idx) {
$(e.target).find(".caosdb-properties .caosdb-f-entity-property").each(function(idx) {
fileupload.create_upload_app(this);
});
});
}, true);
}
// add global listener for property_added event
document.body.addEventListener(edit_mode.property_added.type, function(e) {
fileupload.create_upload_app(e.target);
}, true);
// add global listener for property_added event
document.body.addEventListener(edit_mode.property_added.type, function(e) {
fileupload.create_upload_app(e.target);
}, true);
}
// add global listener for data_type_changed event
document.body.addEventListener(edit_mode.property_data_type_changed.type, function(e) {
......@@ -302,7 +307,7 @@ var fileupload = new function() {
this.create_upload_app = function(target) {
const non_file_datatypes = ["TEXT", "DOUBLE", "BOOLEAN", "INTEGER", "DATETIME"];
var par = getPropertyDatatype(target);
var atom_par = par && par.startsWith("LIST<") && par.endsWith(">") ? par.substring(5, par.length-1) : par;
var atom_par = par && par.startsWith("LIST<") && par.endsWith(">") ? par.substring(5, par.length - 1) : par;
if (non_file_datatypes.indexOf(atom_par) !== -1) {
return;
......@@ -344,7 +349,7 @@ var fileupload = new function() {
*/
this.get_default_path = function() {
var by = "unauthenticated/";
if(isAuthenticated()) {
if (isAuthenticated()) {
by = getUserRealm() + "/" + getUserName() + "/";
}
return "/uploaded.by/" + by + fileupload.uuidv4() + "/";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment