Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/css/alpaca-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down
1 change: 0 additions & 1 deletion src/css/alpaca-fields.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@

.alpaca-fileupload-container .row
{
margin-bottom: 10px;
}

.alpaca-fileupload-well
Expand Down
7 changes: 5 additions & 2 deletions src/js/Alpaca.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 19 additions & 10 deletions src/js/fields/advanced/UploadField.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
"name": file.name,
"size": file.size,
"url": file.url,
"thumbnailUrl": file.thumbnailUrl
"thumbnailUrl": file.thumbnailUrl || file.url
};

// substitute any tokens
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -982,8 +982,12 @@
return value;
},

setValue: function(value)
setValue: function(value, internal)
{
if (typeof internal === 'undefined') {
internal = false;
}

if (!value)
{
this.data = [];
Expand All @@ -1000,6 +1004,10 @@
}
}

if (internal == false) {
this.reload(function() {});
}
this.refreshUIState();
this.updateObservable();

this.triggerUpdate();
Expand All @@ -1024,7 +1032,7 @@

if (self.isArrayType())
{
self.setValue(array);
self.setValue(array, true);
}
else if (self.isObjectType())
{
Expand All @@ -1033,7 +1041,7 @@
val = array[0];
}

self.setValue(val);
self.setValue(val, true);
}
},

Expand Down Expand Up @@ -1114,17 +1122,18 @@
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");

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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<td class="size"><span>{{file.size}}</span></td>
<td colspan="2"></td>
{{/if}}
<td>
<td class="text-center">
{{#if buttons}}
{{#each buttons}}
{{#if isDelete}}
Expand Down
27 changes: 14 additions & 13 deletions src/templates/bootstrap-display/control-upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

<div class="alpaca-fileupload-container {{#if cssClasses}}{{cssClasses}}{{/if}}">
<div class="container-fluid">
<div class="row alpaca-fileupload-chooserow">
<div class="col-md-12">
<div class="btn-group">
<span class="{{view.styles.button}} fileinput-button">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-add-button">{{chooseButtonLabel}}</span>
<input class="alpaca-fileupload-input" type="file" name="{{name}}_files">
<input class="alpaca-fileupload-input-hidden" type="hidden" name="{{name}}_files_hidden">
</span>
</div>
</div>
</div>
<div class="row alpaca-fileupload-well">
<div class="col-md-12 fileupload-active-zone">
<table class="table table-striped">
Expand All @@ -28,7 +16,7 @@
<td>Name</td>
<td>Size</td>
<td colspan="2"></td><!-- error or start or progress indicator -->
<td>Actions</td>
<td class="text-center">Actions</td>
</tr>
</thead>
{{/if}}
Expand All @@ -45,6 +33,19 @@
</div>
</div>
</div>

<div class="row alpaca-fileupload-chooserow">
<div class="col-md-12 text-right">
<div class="btn-group">
<span class="{{view.styles.button}} fileinput-button">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-add-button">{{chooseButtonLabel}}</span>
<input class="alpaca-fileupload-input" type="file" name="{{name}}_files">
<input class="alpaca-fileupload-input-hidden" type="hidden" name="{{name}}_files_hidden">
</span>
</div>
</div>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<td class="size"><span>{{file.size}}</span></td>
<td colspan="2"></td>
{{/if}}
<td>
<td class="text-center">
{{#if buttons}}
{{#each buttons}}
{{#if isDelete}}
Expand Down
26 changes: 13 additions & 13 deletions src/templates/bootstrap-edit/control-upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

<div class="alpaca-fileupload-container {{#if cssClasses}}{{cssClasses}}{{/if}}">
<div class="container-fluid">
<div class="row alpaca-fileupload-chooserow">
<div class="col-md-12">
<div class="btn-group">
<span class="{{view.styles.button}} fileinput-button">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-add-button">{{chooseButtonLabel}}</span>
<input class="alpaca-fileupload-input" type="file" name="{{name}}_files">
<input class="alpaca-fileupload-input-hidden" type="hidden" name="{{name}}_files_hidden">
</span>
</div>
</div>
</div>
<div class="row alpaca-fileupload-well">
<div class="col-md-12 fileupload-active-zone">
<table class="table table-striped">
Expand All @@ -28,7 +16,7 @@
<td>Name</td>
<td>Size</td>
<td colspan="2"></td><!-- error or start or progress indicator -->
<td>Actions</td>
<td class="text-center">Actions</td>
</tr>
</thead>
{{/if}}
Expand All @@ -45,6 +33,18 @@
</div>
</div>
</div>
<div class="row alpaca-fileupload-chooserow">
<div class="col-md-12 text-right">
<div class="btn-group">
<span class="{{view.styles.button}} fileinput-button">
<i class="glyphicon glyphicon-upload"></i>
<span class="fileupload-add-button">{{chooseButtonLabel}}</span>
<input class="alpaca-fileupload-input" type="file" name="{{name}}_files">
<input class="alpaca-fileupload-input-hidden" type="hidden" name="{{name}}_files_hidden">
</span>
</div>
</div>
</div>
</div>
</div>

Expand Down