Files are uploading and clearing per variant now with the file upload control

This commit is contained in:
Shannon
2018-08-07 18:05:30 +10:00
parent cd89d016d1
commit 96ea95b04a
8 changed files with 26 additions and 68 deletions

View File

@@ -22,7 +22,16 @@
vm.files = [];
//notify the callback
vm.onValueChanged({ value: null });
notifyValueChanged(null);
}
function notifyValueChanged(val) {
//notify the callback
vm.onValueChanged({ value: val });
//need to explicity setDirty here to track changes
vm.fileUploadForm.$setDirty();
}
/** Called when the component initializes */
@@ -119,10 +128,7 @@
return null;
}
var thumbnailUrl = umbRequestHelper.getApiUrl(
"imagesApiBaseUrl",
"GetBigThumbnail",
[{ originalImagePath: file.fileName }]) + '&rnd=' + Math.random();
var thumbnailUrl = mediaHelper.getThumbnailFromPath(file.fileName);
return thumbnailUrl;
}
@@ -186,12 +192,8 @@
});
var newVal = updateModelFromSelectedFiles(args.files);
//need to explicity setDirty here to track changes
vm.fileUploadForm.$setDirty();
//notify the callback
vm.onValueChanged({ value: newVal });
notifyValueChanged(newVal);
}
angularHelper.safeApply($scope);

View File

@@ -307,11 +307,8 @@ function mediaHelper(umbRequestHelper) {
var thumbnailUrl = umbRequestHelper.getApiUrl(
"imagesApiBaseUrl",
"GetBigThumbnail",
[{ originalImagePath: imagePath }]);
//var ext = imagePath.substr(imagePath.lastIndexOf('.'));
//return imagePath.substr(0, imagePath.lastIndexOf('.')) + "_big-thumb" + ".jpg";
[{ originalImagePath: imagePath }]) + '&rnd=' + Math.random();
return thumbnailUrl;
},

View File

@@ -1,5 +1,6 @@
<div>
<ng-form name="vm.fileUploadForm">
<div class="fileinput-button umb-upload-button-big"
style="margin-bottom: 5px;"
ng-hide="vm.files.length > 0">

View File

@@ -20,6 +20,11 @@
*/
function valueChanged(value) {
$scope.model.value = value;
//if the value is empty, then tell the server to clear the files
if (!$scope.model.value) {
$scope.model.value = { clearFiles: true };
}
}
};

View File

@@ -1,6 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.FileUploadController">
<pre><code>{{model.value}}</code></pre>
<umb-property-file-upload culture="{{model.culture}}"
property-alias="{{model.alias}}"
value="model.value"