diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js index bd8c505a3d..2a51738bbd 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js @@ -15,7 +15,8 @@ Umbraco.Sys.ServerVariables = { "legacyTreeJs": "/belle/lib/yepnope/empty.js", }, umbracoSettings: { - "umbracoPath": "/umbraco" + "umbracoPath": "/umbraco", + "imageFileTypes": "jpeg,jpg,gif,bmp,png,tiff,tif" }, isDebuggingEnabled: true }; \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js index b3713da0f6..51e3d9b748 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js @@ -208,15 +208,16 @@ function umbImageHelper() { return item.alias === 'umbracoFile'; }); var imageVal; - //Legacy images will be saved as a string, not an array so we will convert the legacy values - // to our required structure. - if (imageProp.value.startsWith('[')) { - imageVal = options.scope.$eval(imageProp.value); - } - else { - imageVal = [{ file: imageProp.value, isImage: this.detectIfImageByExtension(imageProp.value) }]; - } + //our default images might store one or many images (as csv) + var split = imageProp.value.split(','); + var self = this; + imageVal = _.map(split, function(item) { + return { file: item, isImage: self.detectIfImageByExtension(item) }; + }); + + //for now we'll just return the first image in the collection. + //TODO: we should enable returning many to be displayed in the picker if the uploader supports many. if (imageVal.length && imageVal.length > 0 && imageVal[0].isImage) { return imageVal[0].file; } @@ -242,10 +243,8 @@ function umbImageHelper() { }, detectIfImageByExtension: function(imagePath) { var lowered = imagePath; - if (lowered.endsWith(".jpg") || lowered.endsWith(".gif") || lowered.endsWith(".jpeg") || lowered.endsWith(".png")) { - return true; - } - return false; + var ext = lowered.substr(lowered.lastIndexOf(".") + 1); + return ("," + Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes + ",").indexOf("," + ext + ",") !== -1; } }; } diff --git a/src/Umbraco.Web.UI.Client/src/less/modals.less b/src/Umbraco.Web.UI.Client/src/less/modals.less index 152702b4d0..07149a27a5 100644 --- a/src/Umbraco.Web.UI.Client/src/less/modals.less +++ b/src/Umbraco.Web.UI.Client/src/less/modals.less @@ -136,9 +136,9 @@ border:none; } -.umb-modal .thumbnails > li:nth-child(2) { +/*.umb-modal .thumbnails > li:nth-child(2) { margin: 0 0 20px 0 -} +}*/ .umb-modal .thumbnails > li { margin: 0 20px 20px 0; @@ -146,7 +146,7 @@ } .umb-modal .thumbnail img { - height: 120px + /*height: 100px;*/ } .umb-modal .thumbnails .selected img, .umb-modal .thumbnails img:hover { @@ -154,8 +154,8 @@ } .umb-modal .thumbnails > li.folder { - width: 120px; - height: 120px; + width: 100px; + /*height: 100px;*/ display: block; background: @grayLighter; text-align: center; @@ -165,12 +165,13 @@ .umb-modal .thumbnails > li.folder .icon-folder-close { color: @grayLight; display: block; - font-size: 96px + font-size: 96px; + width:100px; } .umb-modal .thumbnails > li.folder a { - width: 120px; - height: 120px; + width: 100px; + height: 100px; display: block } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js index 550336d28f..51b51de12d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.controller.js @@ -20,28 +20,24 @@ function fileUploadController($scope, $element, $compile, umbImageHelper) { //clear the current files $scope.files = []; + //create the property to show the list of files currently saved if ($scope.model.value != "") { - //for legacy data, this will not be an array, just a string so convert to an array - if (!$scope.model.value.startsWith('[')) { - - //check if it ends with a common image extensions - var isImage = umbImageHelper.detectIfImageByExtension($scope.model.value); - $scope.model.value = "[{\"file\": \"" + $scope.model.value + "\",\"isImage\":" + isImage + "}]"; - } - - $scope.persistedFiles = angular.fromJson($scope.model.value); + var images = $scope.model.value.split(","); + + $scope.persistedFiles = _.map(images, function (item) { + return { file: item, isImage: umbImageHelper.detectIfImageByExtension(item) }; + }); } else { $scope.persistedFiles = []; } - + _.each($scope.persistedFiles, function (file) { file.thumbnail = umbImageHelper.getThumbnailFromPath(file.file); }); - - + $scope.clearFiles = false; //listen for clear files changes to set our model to be sent up to the server diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html index 1257abfa70..9cbbf816af 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/fileupload/fileupload.html @@ -2,12 +2,14 @@
- -
+ +
+ -
-

Current files

+