Fixes: U4-4502 Umbraco7.0.4 media picker shows uploaded images minus 1

This commit is contained in:
Shannon
2014-03-24 13:43:20 +11:00
parent 98f76a989f
commit 5e43ddc13c
3 changed files with 13 additions and 3 deletions

View File

@@ -14,6 +14,8 @@ angular.module("umbraco.directives.html")
templateUrl: 'views/directives/html/umb-photo-folder.html',
link: function(scope, element, attrs, ngModel) {
var lastWatch = null;
ngModel.$render = function() {
if (ngModel.$modelValue) {
@@ -37,7 +39,15 @@ angular.module("umbraco.directives.html")
scope.rows = umbPhotoFolderHelper.buildGrid(photos, fixedRowWidth, maxHeight, startingIndex, minHeight, idealImgPerRow, margin);
if (attrs.filterBy) {
scope.$watch(attrs.filterBy, function(newVal, oldVal) {
//we track the watches that we create, we don't want to create multiple, so clear it
// if it already exists before creating another.
if (lastWatch) {
lastWatch();
}
//TODO: Need to debounce this so it doesn't filter too often!
lastWatch = scope.$watch(attrs.filterBy, function (newVal, oldVal) {
if (newVal && newVal !== oldVal) {
var p = $filter('filter')(photos, newVal, false);
scope.baseline = 0;

View File

@@ -198,7 +198,7 @@ function umbPhotoFolderHelper($compile, $log, $timeout, $filter, imageHelper, me
//in this case, a single image will not fit into the row so we need to crop/center
// width the full width and the min display height
if (imgs.length > 1 && imageRowHeight.imgCount === 1) {
if (imageRowHeight.imgCount === 1) {
sizes.push({
width: targetWidth,
//ensure that the height is rounded