early testing
This commit is contained in:
@@ -397,6 +397,54 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.listViewHelper#selectAllItemsToggle
|
||||
* @methodOf umbraco.services.listViewHelper
|
||||
*
|
||||
* @description
|
||||
* Helper method for toggling the select state on all items.
|
||||
*
|
||||
* @param {Array} items Items to toggle selection on, should be $scope.items
|
||||
* @param {Array} selection Listview selection, available as $scope.selection
|
||||
*/
|
||||
|
||||
function selectAllItemsToggle(items, selection) {
|
||||
|
||||
if (!angular.isArray(items)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSelectedAll()) {
|
||||
// unselect all items
|
||||
angular.forEach(items, function (item) {
|
||||
item.selected = false;
|
||||
});
|
||||
|
||||
// reset selection without loosing reference.
|
||||
selection.length = 0;
|
||||
|
||||
} else {
|
||||
|
||||
// reset selection without loosing reference.
|
||||
selection.length = 0;
|
||||
|
||||
// select all items
|
||||
angular.forEach(items, function (item) {
|
||||
var obj = {
|
||||
id: item.id
|
||||
};
|
||||
if (item.key) {
|
||||
obj.key = item.key;
|
||||
}
|
||||
item.selected = true;
|
||||
vm.selection.push(user.id);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
|
||||
@@ -7,12 +7,16 @@
|
||||
<input class="umb-table__input" type="checkbox"
|
||||
ng-show="vm.allowSelectAll"
|
||||
ng-click="vm.selectAll($event)"
|
||||
ng-checked="vm.isSelectedAll()">
|
||||
ng-checked="vm.isSelectedAll()"/>
|
||||
|
||||
<a href="" style="text-decoration: none;" ng-show="vm.allowSelectAll" ng-click="vm.selectAll()">
|
||||
<umb-checkmark checked="vm.isSelectedAll()" size="xs"></umb-checkmark>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="umb-table-cell umb-table__name">
|
||||
<localize key="general_name">Name</localize>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': vm.isSortDirection('Name', 'asc'), 'icon-navigation-down': vm.isSortDirection('Name', 'desc')}"></i>
|
||||
</a>
|
||||
<localize key="general_name">Name</localize>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': vm.isSortDirection('Name', 'asc'), 'icon-navigation-down': vm.isSortDirection('Name', 'desc')}"></i>
|
||||
</div>
|
||||
<div class="umb-table-cell" ng-show="vm.items[0].state">
|
||||
<localize key="general_status">Status</localize>
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function selectAll($event) {
|
||||
listViewHelper.selectAllItems($scope.items, $scope.selection, $event);
|
||||
function selectAll() {
|
||||
listViewHelper.selectAllItemsToggle($scope.items, $scope.selection);
|
||||
}
|
||||
|
||||
function isSelectedAll() {
|
||||
|
||||
Reference in New Issue
Block a user