From ea24d72f01886f1f6deb767134b1dea0924455e1 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 10 May 2017 12:17:26 -0400 Subject: [PATCH] group accessall and readonly --- .../organizationCollectionsAddController.js | 5 +- .../organizationCollectionsEditController.js | 5 +- .../organizationGroupsAddController.js | 11 ++- .../organizationGroupsEditController.js | 19 +++-- .../views/organizationCollectionsAdd.html | 5 +- .../views/organizationCollectionsEdit.html | 5 +- .../views/organizationGroupsAdd.html | 80 +++++++++++-------- .../views/organizationGroupsEdit.html | 80 +++++++++++-------- 8 files changed, 130 insertions(+), 80 deletions(-) diff --git a/src/app/organization/organizationCollectionsAddController.js b/src/app/organization/organizationCollectionsAddController.js index 6ac9e00ad1..d220044ec3 100644 --- a/src/app/organization/organizationCollectionsAddController.js +++ b/src/app/organization/organizationCollectionsAddController.js @@ -32,7 +32,8 @@ for (var i = 0; i < groups.Data.length; i++) { groupsArr.push({ id: groups.Data[i].Id, - name: groups.Data[i].Name + name: groups.Data[i].Name, + accessAll: groups.Data[i].AccessAll }); } @@ -61,7 +62,7 @@ }; $scope.groupSelected = function (group) { - return group.id in $scope.selectedGroups; + return group.id in $scope.selectedGroups || group.accessAll; }; $scope.allSelected = function () { diff --git a/src/app/organization/organizationCollectionsEditController.js b/src/app/organization/organizationCollectionsEditController.js index af01c3a3fb..064308110b 100644 --- a/src/app/organization/organizationCollectionsEditController.js +++ b/src/app/organization/organizationCollectionsEditController.js @@ -45,7 +45,8 @@ for (var i = 0; i < groups.Data.length; i++) { groupsArr.push({ id: groups.Data[i].Id, - name: groups.Data[i].Name + name: groups.Data[i].Name, + accessAll: groups.Data[i].AccessAll }); } @@ -74,7 +75,7 @@ }; $scope.groupSelected = function (group) { - return group.id in $scope.selectedGroups; + return group.id in $scope.selectedGroups || group.accessAll; }; $scope.allSelected = function () { diff --git a/src/app/organization/organizationGroupsAddController.js b/src/app/organization/organizationGroupsAddController.js index ef78c369b3..4f20c126d6 100644 --- a/src/app/organization/organizationGroupsAddController.js +++ b/src/app/organization/organizationGroupsAddController.js @@ -46,12 +46,15 @@ $scope.submit = function (model) { var group = { name: model.name, - collectionIds: [] + accessAll: !!model.accessAll }; - for (var id in $scope.selectedCollections) { - if ($scope.selectedCollections.hasOwnProperty(id)) { - group.collectionIds.push(id); + if (!group.accessAll) { + group.collectionIds = []; + for (var id in $scope.selectedCollections) { + if ($scope.selectedCollections.hasOwnProperty(id)) { + group.collectionIds.push(id); + } } } diff --git a/src/app/organization/organizationGroupsEditController.js b/src/app/organization/organizationGroupsEditController.js index 2a0b33862c..41e77d0f70 100644 --- a/src/app/organization/organizationGroupsEditController.js +++ b/src/app/organization/organizationGroupsEditController.js @@ -13,7 +13,8 @@ }).then(function (group) { $scope.group = { id: id, - name: group.Name + name: group.Name, + accessAll: group.AccessAll }; var collections = {}; @@ -59,11 +60,17 @@ }; $scope.submit = function () { - var group = $scope.group; - group.collectionIds = []; - for (var id in $scope.selectedCollections) { - if ($scope.selectedCollections.hasOwnProperty(id)) { - group.collectionIds.push(id); + var group = { + name: $scope.group.name, + accessAll: !!$scope.group.accessAll + }; + + if (!group.accessAll) { + group.collectionIds = []; + for (var id in $scope.selectedCollections) { + if ($scope.selectedCollections.hasOwnProperty(id)) { + group.collectionIds.push(id); + } } } diff --git a/src/app/organization/views/organizationCollectionsAdd.html b/src/app/organization/views/organizationCollectionsAdd.html index 005a030b54..d7d774b236 100644 --- a/src/app/organization/views/organizationCollectionsAdd.html +++ b/src/app/organization/views/organizationCollectionsAdd.html @@ -51,10 +51,13 @@ name="selectedGroups[]" value="{{group.id}}" ng-checked="groupSelected(group)" - ng-click="toggleGroupSelection(group.id)"> + ng-click="toggleGroupSelection(group.id)" + ng-disabled="group.accessAll"> {{group.name}} + diff --git a/src/app/organization/views/organizationCollectionsEdit.html b/src/app/organization/views/organizationCollectionsEdit.html index 7fdea03d3e..8f8179727d 100644 --- a/src/app/organization/views/organizationCollectionsEdit.html +++ b/src/app/organization/views/organizationCollectionsEdit.html @@ -52,10 +52,13 @@ name="selectedGroups[]" value="{{group.id}}" ng-checked="groupSelected(group)" - ng-click="toggleGroupSelection(group.id)"> + ng-click="toggleGroupSelection(group.id)" + ng-disabled="group.accessAll"> {{group.name}} + diff --git a/src/app/organization/views/organizationGroupsAdd.html b/src/app/organization/views/organizationGroupsAdd.html index 4f50aa8587..cf0d406f61 100644 --- a/src/app/organization/views/organizationGroupsAdd.html +++ b/src/app/organization/views/organizationGroupsAdd.html @@ -21,40 +21,56 @@ -

Collections

-
- Loading collections... +

Access

+
+
-
-

No collections for your organization.

+
+
-
- - - - - - - - - - - - - -
- - Name
- - - {{collection.name}} -
+
+
+ Loading collections... +
+
+

No collections for your organization.

+
+
+ + + + + + + + + + + + + +
+ + Name
+ + + {{collection.name}} +
+
-

Collections

-
- Loading collections... +

Access

+
+
-
-

No collections for your organization.

+
+
-
- - - - - - - - - - - - - -
- - Name
- - - {{collection.name}} -
+
+
+ Loading collections... +
+
+

No collections for your organization.

+
+
+ + + + + + + + + + + + + +
+ + Name
+ + + {{collection.name}} +
+