add directive for list view layouts so we do not get values from parent scope
This commit is contained in:
@@ -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);
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<div ng-include="options.layout.activeLayout.path"></div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
ng-if="entityType !== 'media'">
|
||||
|
||||
<umb-content-grid
|
||||
content="listViewResultSet.items"
|
||||
content="items"
|
||||
content-properties="options.includeProperties"
|
||||
on-click="vm.clickItem"
|
||||
on-select="vm.selectItem">
|
||||
@@ -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">
|
||||
</umb-file-dropzone>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</umb-folder-grid>
|
||||
|
||||
<umb-media-grid
|
||||
items="listViewResultSet.items"
|
||||
items="items"
|
||||
on-details-hover="vm.hoverMediaItemDetails"
|
||||
on-select="vm.selectItem"
|
||||
on-click="vm.clickItem">
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody ng-show="listViewResultSet.totalItems === 0">
|
||||
<tbody ng-show="items.length === 0">
|
||||
<tr>
|
||||
<td colspan="{{options.includeProperties.length + 2}}">
|
||||
<p><localize key="content_listViewNoItems">There are no items show in the list.</localize></p>
|
||||
@@ -30,22 +30,22 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tbody ng-show="listViewResultSet.totalItems > 0">
|
||||
<tr ng-repeat="result in listViewResultSet.items"
|
||||
ng-class="{selected:result.selected}">
|
||||
<tbody ng-show="items.length > 0">
|
||||
<tr ng-repeat="item in items"
|
||||
ng-class="{selected:item.selected}">
|
||||
|
||||
<td>
|
||||
<i class="icon {{result.icon}}" ng-class="getIcon(result)"></i>
|
||||
<input type="checkbox" ng-click="vm.selectItem(result)" ng-model="result.selected" no-dirty-check>
|
||||
<i class="icon {{item.icon}}" ng-class="getIcon(item)"></i>
|
||||
<input type="checkbox" ng-click="vm.selectItem(item)" ng-model="item.selected" no-dirty-check>
|
||||
</td>
|
||||
<td>
|
||||
<a ng-class="{inactive: (entityType === 'content' && !result.published) || isTrashed}"
|
||||
href="#{{result.editPath}}"
|
||||
ng-bind="result.name"></a>
|
||||
<a ng-class="{inactive: (entityType === 'content' && !item.published) || isTrashed}"
|
||||
href="#{{item.editPath}}"
|
||||
ng-bind="item.name"></a>
|
||||
</td>
|
||||
|
||||
<td ng-repeat="column in options.includeProperties">
|
||||
<span>{{result[column.alias]}}</span>
|
||||
<span>{{item[column.alias]}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,15 @@
|
||||
|
||||
</umb-editor-sub-header>
|
||||
|
||||
|
||||
<div ng-include="options.layout.activeLayout.path"></div>
|
||||
<umb-list-view-layout
|
||||
content-id="contentId"
|
||||
folders="folders"
|
||||
items="listViewResultSet.items"
|
||||
selection="selection"
|
||||
options="options"
|
||||
entity-type="{{entityType}}"
|
||||
on-get-content="reloadView">
|
||||
</umb-list-view-layout>
|
||||
|
||||
<umb-pagination
|
||||
ng-if="listViewResultSet.totalPages"
|
||||
|
||||
Reference in New Issue
Block a user