Skip to content

Commit

Permalink
#700 change codes for removing disabled button
Browse files Browse the repository at this point in the history
  • Loading branch information
schoicsiro committed Sep 19, 2023
1 parent dc9cc21 commit 3332259
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ profileEditor.controller('UserAccessController', function (messageService, util,
if (self.opus.privateCollection) {
self.roles.push(userRole);
} else {
self.roles.splice(4, 1)
if (form.$dirty) {
var hasRole_USER = self.users.find(it=>it.role === 'ROLE_USER')
if (form.$dirty && hasRole_USER) {
self.users = self.users.filter(it => it.role !== 'ROLE_USER')
var data = {privateCollection: self.opus.privateCollection, authorities: self.users};
var promise = profileService.updateUsers(self.opusId, data);
Expand All @@ -95,6 +95,7 @@ profileEditor.controller('UserAccessController', function (messageService, util,
messageService.alert("An error has occurred while updating user access.");
});
}
self.roles.splice(4, 1)
}
};

Expand Down
4 changes: 2 additions & 2 deletions grails-app/views/opus/_editAccessControl.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
<div class="row">
<div class="col-md-12" ng-show="userCtrl.accessControlTab == 'user'">
<div class="btn-group">
<button class="btn btn-default" ng-click="userCtrl.addUser(UserForm)" ng-disabled="!userCtrl.opus.privateCollection && UserForm.$dirty">
<button class="btn btn-default" ng-click="userCtrl.addUser(UserForm)">
<i class="fa fa-plus"></i> Add user</button>
<button class="btn btn-default" ng-click="userCtrl.reset(UserForm)" ng-disabled="!userCtrl.opus.privateCollection && UserForm.$dirty">Reset</button>
<button class="btn btn-default" ng-click="userCtrl.reset(UserForm)">Reset</button>
</div>
<save-button ng-click="userCtrl.save(UserForm)" form="UserForm"></save-button>
</div>
Expand Down

0 comments on commit 3332259

Please sign in to comment.