mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 02:06:03 +02:00
fixed view icon
This commit is contained in:
parent
7f112c1295
commit
1dfe34d9c6
2 changed files with 4 additions and 8 deletions
|
@ -124,7 +124,7 @@ def serialize_domain(domain, user):
|
||||||
|
|
||||||
# Check if there is a UserDomainRole for this domain and user
|
# Check if there is a UserDomainRole for this domain and user
|
||||||
user_domain_role_exists = UserDomainRole.objects.filter(domain_id=domain.id, user=user).exists()
|
user_domain_role_exists = UserDomainRole.objects.filter(domain_id=domain.id, user=user).exists()
|
||||||
|
view_only = not user_domain_role_exists or domain.state in [Domain.State.DELETED, Domain.State.ON_HOLD]
|
||||||
return {
|
return {
|
||||||
"id": domain.id,
|
"id": domain.id,
|
||||||
"name": domain.name,
|
"name": domain.name,
|
||||||
|
@ -133,11 +133,7 @@ def serialize_domain(domain, user):
|
||||||
"state_display": domain.state_display(),
|
"state_display": domain.state_display(),
|
||||||
"get_state_help_text": domain.get_state_help_text(),
|
"get_state_help_text": domain.get_state_help_text(),
|
||||||
"action_url": reverse("domain", kwargs={"pk": domain.id}),
|
"action_url": reverse("domain", kwargs={"pk": domain.id}),
|
||||||
"action_label": (
|
"action_label": ("View" if view_only else "Manage"),
|
||||||
"View"
|
"svg_icon": ("visibility" if view_only else "settings"),
|
||||||
if not user_domain_role_exists or domain.state in [Domain.State.DELETED, Domain.State.ON_HOLD]
|
|
||||||
else "Manage"
|
|
||||||
),
|
|
||||||
"svg_icon": ("visibility" if domain.state in [Domain.State.DELETED, Domain.State.ON_HOLD] else "settings"),
|
|
||||||
"suborganization": suborganization_name,
|
"suborganization": suborganization_name,
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class DomainPermission(PermissionsLoginMixin):
|
||||||
|
|
||||||
def can_access_domain_via_portfolio(self, pk):
|
def can_access_domain_via_portfolio(self, pk):
|
||||||
"""Most views should not allow permission to portfolio users.
|
"""Most views should not allow permission to portfolio users.
|
||||||
If particular views allow permissions, they will need to override
|
If particular views allow access to the domain pages, they will need to override
|
||||||
this function."""
|
this function."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue