group accessall and readonly

This commit is contained in:
Kyle Spearrin 2017-05-10 12:17:26 -04:00
parent a4473ad739
commit ea24d72f01
8 changed files with 130 additions and 80 deletions

View File

@ -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 () {

View File

@ -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 () {

View File

@ -46,14 +46,17 @@
$scope.submit = function (model) {
var group = {
name: model.name,
collectionIds: []
accessAll: !!model.accessAll
};
if (!group.accessAll) {
group.collectionIds = [];
for (var id in $scope.selectedCollections) {
if ($scope.selectedCollections.hasOwnProperty(id)) {
group.collectionIds.push(id);
}
}
}
$scope.submitPromise = apiService.groups.post({ orgId: $state.params.orgId }, group, function (response) {
$analytics.eventTrack('Created Group');

View File

@ -13,7 +13,8 @@
}).then(function (group) {
$scope.group = {
id: id,
name: group.Name
name: group.Name,
accessAll: group.AccessAll
};
var collections = {};
@ -59,13 +60,19 @@
};
$scope.submit = function () {
var group = $scope.group;
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);
}
}
}
$scope.submitPromise = apiService.groups.put({ orgId: $state.params.orgId }, group, function (response) {
$analytics.eventTrack('Edited Group');

View File

@ -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">
</td>
<td valign="middle">
{{group.name}}
<i class="fa fa-unlock text-muted" ng-show="group.accessAll"
title="This group can access all items"></i>
</td>
</tr>
</tbody>

View File

@ -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">
</td>
<td valign="middle">
{{group.name}}
<i class="fa fa-unlock text-muted" ng-show="group.accessAll"
title="This group can access all items"></i>
</td>
</tr>
</tbody>

View File

@ -21,7 +21,22 @@
<label for="email">Name</label>
<input type="text" id="name" name="Name" ng-model="model.name" class="form-control" required api-field />
</div>
<h4>Collections</h4>
<h4>Access</h4>
<div class="radio">
<label>
<input type="radio" ng-model="model.accessAll" name="AccessAll"
ng-value="true" ng-checked="model.accessAll">
This group can access and modify <u>all items</u>.
</label>
</div>
<div class="radio">
<label>
<input type="radio" ng-model="model.accessAll" name="AccessAll"
ng-value="false" ng-checked="!model.accessAll">
This group can access only the selected collections.
</label>
</div>
<div ng-show="!model.accessAll">
<div ng-show="loading && !collections.length">
Loading collections...
</div>
@ -57,6 +72,7 @@
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit

View File

@ -21,7 +21,22 @@
<label for="email">Name</label>
<input type="text" id="name" name="Name" ng-model="group.name" class="form-control" required api-field />
</div>
<h4>Collections</h4>
<h4>Access</h4>
<div class="radio">
<label>
<input type="radio" ng-model="group.accessAll" name="AccessAll"
ng-value="true" ng-checked="group.accessAll">
This group can access and modify <u>all items</u>.
</label>
</div>
<div class="radio">
<label>
<input type="radio" ng-model="group.accessAll" name="AccessAll"
ng-value="false" ng-checked="!group.accessAll">
This group can access only the selected collections.
</label>
</div>
<div ng-show="!group.accessAll">
<div ng-show="loading && !collections.length">
Loading collections...
</div>
@ -57,6 +72,7 @@
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Submit