diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umblistviewlayout.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umblistviewlayout.directive.js new file mode 100644 index 0000000000..d026a3f4e5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umblistviewlayout.directive.js @@ -0,0 +1,37 @@ +(function() { + 'use strict'; + + function ListViewLayoutDirective() { + + function link(scope, el, attr, ctrl) { + + scope.getContent = function(contentId) { + if(scope.onGetContent) { + scope.onGetContent(contentId); + } + }; + + } + + var directive = { + restrict: 'E', + replace: true, + templateUrl: 'views/components/umb-list-view-layout.html', + scope: { + contentId: '=', + folders: '=', + items: '=', + selection: '=', + options: '=', + entityType: '@', + onGetContent: '=' + }, + link: link + }; + + return directive; + } + + angular.module('umbraco.directives').directive('umbListViewLayout', ListViewLayoutDirective); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-list-view-layout.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-list-view-layout.html new file mode 100644 index 0000000000..a4ea2d2481 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-list-view-layout.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.html index 2b03e20e2c..83ca164244 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.html @@ -4,7 +4,7 @@ ng-if="entityType !== 'media'"> @@ -22,8 +22,8 @@ parent-id="{{vm.nodeId}}" files-uploaded="vm.onUploadComplete" accept="{{vm.acceptedFileTypes}}" - hide-dropzone="{{!vm.activeDrag && listViewResultSet.items.length > 0 }}" - compact="{{ listViewResultSet.items.length > 0 }}" + hide-dropzone="{{!vm.activeDrag && items.length > 0 }}" + compact="{{ items.length > 0 }}" files-queued="vm.onFilesQueue"> @@ -35,7 +35,7 @@ diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js index e963a62567..c63f1011e4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js @@ -13,7 +13,6 @@ var vm = this; - //pass in the content id from the grid view parent scope (badbadnotgood) vm.nodeId = $scope.contentId; vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes); vm.activeDrag = false; @@ -41,10 +40,7 @@ } function onUploadComplete() { - - // call reload function on list view parent controller - $scope.reloadView($scope.contentId); - + $scope.getContent($scope.contentId); } function hoverMediaItemDetails(item, event, hover) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html index b85b1dba89..60f06e6378 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.html @@ -22,7 +22,7 @@ - +

There are no items show in the list.

@@ -30,22 +30,22 @@ - - + + - - + + - + - {{result[column.alias]}} + {{item[column.alias]}} diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js index 8a281f4706..e7144a40e4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/list/list.listviewlayout.controller.js @@ -15,15 +15,15 @@ var checkbox = $event.target; var clearSelection = false; - if (!angular.isArray($scope.listViewResultSet.items)) { + if (!angular.isArray($scope.items)) { return; } $scope.selection.length = 0; - for (var i = 0; i < $scope.listViewResultSet.items.length; i++) { + for (var i = 0; i < $scope.items.length; i++) { - var entity = $scope.listViewResultSet.items[i]; + var entity = $scope.items[i]; if (checkbox.checked) { $scope.selection.push({id: entity.id}); @@ -64,10 +64,10 @@ } function isSelectedAll() { - if (!angular.isArray($scope.listViewResultSet.items)) { + if (!angular.isArray($scope.items)) { return false; } - return _.every($scope.listViewResultSet.items, function(item) { + return _.every($scope.items, function(item) { return item.selected; }); } @@ -87,7 +87,8 @@ $scope.options.orderDirection = "desc"; } - $scope.reloadView($scope.contentId); + $scope.getContent($scope.contentId); + } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html index af30ffcdcf..4f9c64d5ed 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html @@ -119,8 +119,15 @@ - -
+ +