Fixes: U4-4477 Single Media picker doesn't show thumbnail any more

This commit is contained in:
perploug
2014-03-19 18:44:46 +01:00
parent 3543204794
commit 4a721ddf34
2 changed files with 15 additions and 25 deletions

View File

@@ -72,15 +72,6 @@ angular.module("umbraco")
if(data.items){
$scope.images = data.items;
}
//update the thumbnail property
//_.each($scope.images, function(img) {
// img.thumbnail = imageHelper.getThumbnail({ imageModel: img, scope: $scope });
//});
//reject all images that have an empty thumbnail - this can occur if there's an image item
// that doesn't have an uploaded image.
if($scope.onlyImages){
$scope.images = _.reject($scope.images, function(item) {
@@ -109,17 +100,10 @@ angular.module("umbraco")
$scope.select(image);
image.cssclass = ($scope.dialogData.selection.indexOf(image) > -1) ? "selected" : "";
}else {
$scope.target= {};
$scope.target.id = image.id;
$scope.target.name = image.name;
$scope.target= image;
$scope.target.url = mediaHelper.resolveFile(image); // getMediaPropertyValue({mediaModel: image});
//$scope.submit(image);
}
}
};
$scope.exitDetails = function(){

View File

@@ -15,20 +15,26 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl
$scope.ids = [];
if ($scope.model.value) {
$scope.ids = $scope.model.value.split(',');
var ids = $scope.model.value.split(',');
mediaResource.getByIds($scope.ids).then(function (medias) {
mediaResource.getByIds(ids).then(function (medias) {
//img.media = media;
_.each(medias, function (media, i) {
if(!media.thumbnail){
media.thumbnail = mediaHelper.resolveFile(media, true);
}
//only show non-trashed items
if(media.parent > -21){
if(!media.thumbnail){
media.thumbnail = mediaHelper.resolveFile(media, true);
}
//media.src = mediaHelper.getImagePropertyValue({ imageModel: media });
//media.thumbnail = mediaHelper.getThumbnailFromPath(media.src);
$scope.images.push(media);
//media.src = mediaHelper.getImagePropertyValue({ imageModel: media });
//media.thumbnail = mediaHelper.getThumbnailFromPath(media.src);
$scope.images.push(media);
$scope.ids.push(media.id);
}
});
$scope.sync();
});
}
}