Skip to content

Commit

Permalink
redo do contributor.mako logic to work for new more specific curator …
Browse files Browse the repository at this point in the history
…methods and add disabled checkboxes to UI
  • Loading branch information
John Tordoff committed Jan 10, 2025
1 parent 5c33833 commit 756a53d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions website/profile/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def serialize_user(user, node=None, admin=False, full=False, is_profile=False, i
'surname': user.family_name,
'fullname': fullname,
'shortname': fullname if len(fullname) < 50 else fullname[:23] + '...' + fullname[-23:],
'is_institutional_admin': user.is_institutional_admin(),
'is_curator': user.is_institutional_curator(node),
'profile_image_url': user.profile_image_url(size=settings.PROFILE_IMAGE_MEDIUM),
'active': user.is_active,
Expand Down
3 changes: 2 additions & 1 deletion website/static/js/accessRequestManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var AccessRequestModel = function(accessRequest, pageOwner, isRegistration, isPa
self.permissionText = ko.observable(self.options.permissionMap[self.permission()]);

self.is_curator = ko.observable(accessRequest.user.is_curator || false);
self.visible = ko.observable(!accessRequest.user.is_curator);
self.is_institutional_admin = ko.observable(accessRequest.user.is_institutional_admin || false);
self.visible = ko.observable(!accessRequest.user.is_institutional_admin);
self.pageOwner = pageOwner;

self.expanded = ko.observable(false);
Expand Down
29 changes: 15 additions & 14 deletions website/templates/project/contributors.mako
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
</div>
</td>
<td>
<div data-bind="ifnot: contributor.is_curator()">
<div data-bind="ifnot: contributor.is_curator">
<div class="header" data-bind="visible: contributor.expanded() && $root.collapsed()"></div>
<div class="td-content" data-bind="visible: !$root.collapsed() || contributor.expanded()">
<input
Expand All @@ -337,19 +337,23 @@
/>
</div>
</div>
<div data-bind="if: contributor.is_curator()">
<div data-bind="if: contributor.is_curator">
<input
type='checkbox'
aria-label='Curator Disabled Bibliographic User Checkbox'
style='background-color: lightgray;'
disabled
checked
>
</div>
</td>
<td>
<div data-bind="if: contributor.is_curator()">
<div data-bind="if: contributor.is_curator">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled checked>
</div>
<div data-bind="ifnot: contributor.is_curator">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled>
</div>
</td>
<td data-bind="css: {'add-remove': !$root.collapsed()}">
<div class="td-content" data-bind="visible: !$root.collapsed() || contributor.expanded()">
Expand Down Expand Up @@ -402,26 +406,23 @@
<td>
<div class="header" data-bind="visible: accessRequest.expanded() && $root.collapsed()"></div>
<div class="td-content" data-bind="visible: !$root.collapsed() || accessRequest.expanded()">
<div data-bind="ifnot: accessRequest.user.is_curator">
<div data-bind="ifnot: accessRequest.user.is_institutional_admin">
<input
type="checkbox" class="biblio"
data-bind="checked: visible"
/>
</div>
<div data-bind="if: accessRequest.user.is_curator">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled>
</div>
</div>
<div data-bind="if: accessRequest.user.is_institutional_admin">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled>
</div>
</td>
<td>
<div class="header" data-bind="visible: accessRequest.expanded() && $root.collapsed()"></div>
<div class="td-content" data-bind="visible: !$root.collapsed() || accessRequest.expanded()">
<div data-bind="ifnot: accessRequest.user.is_curator">
<input
type="checkbox" class="biblio"
data-bind="checked: visible"
/>
<div data-bind="ifnot: accessRequest.user.is_institutional_admin">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled>
</div>
<div data-bind="if: accessRequest.user.is_curator">
<div data-bind="if: accessRequest.user.is_institutional_admin">
<input type="checkbox" aria-label="Curator Confirmation Checkbox" disabled checked>
</div>
</div>
Expand Down

0 comments on commit 756a53d

Please sign in to comment.