diff --git a/src/css/alpaca-bootstrap.css b/src/css/alpaca-bootstrap.css index 006960da8..cdfb130b6 100644 --- a/src/css/alpaca-bootstrap.css +++ b/src/css/alpaca-bootstrap.css @@ -225,8 +225,10 @@ legend.alpaca-container-label /** FIElDS **/ .alpaca-field.alpaca-field-upload .fileupload-active-zone { - margin-top: 50px; - margin-bottom: 50px; + margin-top: 0; + margin-bottom: 0; + padding-left: 0; + padding-right: 0; } .alpaca-field.alpaca-field-upload .template-download TD.error { @@ -251,6 +253,10 @@ legend.alpaca-container-label font-size: 16px; text-align: left; } +.alpaca-field.alpaca-field-upload .alpaca-fileupload-chooserow +{ + margin-bottom: 10px; +} .alpaca-field.alpaca-field-address .alpaca-field-address-mapcanvas { diff --git a/src/css/alpaca-fields.css b/src/css/alpaca-fields.css index 52194db83..96ad69487 100644 --- a/src/css/alpaca-fields.css +++ b/src/css/alpaca-fields.css @@ -98,7 +98,6 @@ .alpaca-fileupload-container .row { - margin-bottom: 10px; } .alpaca-fileupload-well diff --git a/src/js/Alpaca.js b/src/js/Alpaca.js index 8ae860355..88bdcf171 100644 --- a/src/js/Alpaca.js +++ b/src/js/Alpaca.js @@ -2042,15 +2042,18 @@ schema.oneOf[1].type === 'object' && schema.oneOf[1].properties && schema.oneOf[1].properties.url && + schema.oneOf[1]['x-uploader'] && (schema.oneOf[2] == null || schema.oneOf[2].type == 'null') //schema.properties.oneOf[2].uploaded_image_id ) { - // Just use a URL field for now. Set up the uploader later. - schema.properties = schema.oneOf[1].properties; + // Uploader attributes + schema.properties = schema.oneOf[1]['x-uploader']; schema.type = 'object'; + options = schema.properties.url; delete schema.oneOf; } + if (!options.type) { // if nothing passed in, we can try to make a guess based on the type of data diff --git a/src/js/fields/advanced/UploadField.js b/src/js/fields/advanced/UploadField.js index 954212ebc..c242196f4 100644 --- a/src/js/fields/advanced/UploadField.js +++ b/src/js/fields/advanced/UploadField.js @@ -758,7 +758,7 @@ "name": file.name, "size": file.size, "url": file.url, - "thumbnailUrl": file.thumbnailUrl + "thumbnailUrl": file.thumbnailUrl || file.url }; // substitute any tokens @@ -834,7 +834,7 @@ "name": file.name, "size": file.size, "url": file.url, - "thumbnailUrl":file.thumbnailUrl, + "thumbnailUrl":file.thumbnailUrl || file.url, "deleteUrl": file.deleteUrl, "deleteType": file.deleteType }; @@ -871,7 +871,7 @@ "name": descriptor.name, "size": descriptor.size, "url": descriptor.url, - "thumbnailUrl":descriptor.thumbnailUrl, + "thumbnailUrl":descriptor.thumbnailUrl || descriptor.url, "deleteUrl": descriptor.deleteUrl, "deleteType": descriptor.deleteType }; @@ -982,8 +982,12 @@ return value; }, - setValue: function(value) + setValue: function(value, internal) { + if (typeof internal === 'undefined') { + internal = false; + } + if (!value) { this.data = []; @@ -1000,6 +1004,10 @@ } } + if (internal == false) { + this.reload(function() {}); + } + this.refreshUIState(); this.updateObservable(); this.triggerUpdate(); @@ -1024,7 +1032,7 @@ if (self.isArrayType()) { - self.setValue(array); + self.setValue(array, true); } else if (self.isObjectType()) { @@ -1033,7 +1041,7 @@ val = array[0]; } - self.setValue(val); + self.setValue(val, true); } }, @@ -1114,8 +1122,9 @@ var self = this; // disable select files button - $(self.control).find(".btn.fileinput-button").prop("disabled", true); - $(self.control).find(".btn.fileinput-button").attr("disabled", "disabled"); + $(self.control).find(".btn.fileinput-button input[type=file]").prop("disabled", true); + $(self.control).find(".btn.fileinput-button input[type=file]").attr("disabled", "disabled"); + // hide dropzone message $(self.control).find(".fileupload-active-zone p.dropzone-message").css("display", "none"); @@ -1123,8 +1132,8 @@ if (enabled) { // enable select files button - $(self.control).find(".btn.fileinput-button").prop("disabled", false); - $(self.control).find(".btn.fileinput-button").attr("disabled", null); + $(self.control).find(".btn.fileinput-button input[type=file]").prop("disabled", false); + $(self.control).find(".btn.fileinput-button input[type=file]").attr("disabled", null); // show dropzone message $(self.control).find(".fileupload-active-zone p.dropzone-message").css("display", "block"); diff --git a/src/templates/bootstrap-display/control-upload-partial-download.html b/src/templates/bootstrap-display/control-upload-partial-download.html index e4111ed9b..96bdeb830 100644 --- a/src/templates/bootstrap-display/control-upload-partial-download.html +++ b/src/templates/bootstrap-display/control-upload-partial-download.html @@ -27,7 +27,7 @@
| Name | Size | - | Actions | +Actions | {{/if}} @@ -45,6 +33,19 @@ + +{{file.size}} | {{/if}} - | + |
{{#if buttons}}
{{#each buttons}}
{{#if isDelete}}
diff --git a/src/templates/bootstrap-edit/control-upload.html b/src/templates/bootstrap-edit/control-upload.html
index 43b2d7611..4470306d5 100644
--- a/src/templates/bootstrap-edit/control-upload.html
+++ b/src/templates/bootstrap-edit/control-upload.html
@@ -2,18 +2,6 @@
-
-
-
-
-
-
-
|