Hide content in navbar

This commit is contained in:
zandercymatics 2024-10-03 12:27:51 -06:00
parent b08c7e1478
commit eef82382ae
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
7 changed files with 40 additions and 19 deletions

View file

@ -22,11 +22,9 @@ logger = logging.getLogger(__name__)
class RequestingEntityForm(RegistrarForm):
is_policy_acknowledged = forms.BooleanField(
label="I read and agree to the requirements for operating a .gov domain.",
error_messages={
"required": ("Check the box if you read and agree to the requirements for operating a .gov domain.")
},
organization_name = forms.CharField(
label="Organization name",
error_messages={"required": "Enter the name of your organization."},
)

View file

@ -12,8 +12,10 @@
<p>Names that <em>uniquely apply to your organization</em> are likely to be approved over names that could also apply to other organizations.
{% if not is_federal %}In most instances, this requires including your states two-letter abbreviation.{% endif %}</p>
{% if not portfolio %}
<p>Requests for your organizations initials or an abbreviated name might not be approved, but we encourage you to request the name you want.</p>
{% endif %}
<p>Note that <strong>only federal agencies can request generic terms</strong> like
vote.gov.</p>

View file

@ -12,7 +12,11 @@
<h1>Youre about to start your .gov domain request.</h1>
<p>You dont have to complete the process in one session. You can save what you enter and come back to it when youre ready.</p>
{% if portfolio %}
<p>Well use the information you provide to verify your domain request meets our guidelines.</p>
{% else %}
<p>Well use the information you provide to verify your organizations eligibility for a .gov domain. Well also verify that the domain you request meets our guidelines.</p>
{% endif %}
<h2>Time to complete the form</h2>
<p>If you have <a href="{% public_site_url 'domains/before/#information-you%E2%80%99ll-need-to-complete-the-domain-request-form' %}" target="_blank" class="usa-link">all the information you need</a>,
completing your domain request might take around 15 minutes.</p>

View file

@ -8,9 +8,9 @@
{% block form_fields %}
<fieldset class="usa-fieldset">
<legend>
<h2>Are you from the polaris star system?</h2>
<h2>What is the name of your space vessel?</h2>
</legend>
{% input_with_errors forms.0.is_policy_acknowledged %}
{% input_with_errors forms.0.organization_name %}
</fieldset>
{% endblock %}

View file

@ -34,6 +34,7 @@
</ul>
</div>
<ul class="usa-nav__primary usa-accordion">
{% if not hide_domains %}
<li class="usa-nav__primary-item">
{% if has_any_domains_portfolio_permission %}
{% url 'domains' as url %}
@ -44,13 +45,14 @@
Domains
</a>
</li>
{% endif %}
<!-- <li class="usa-nav__primary-item">
<a href="#" class="usa-nav-link">
Domain groups
</a>
</li> -->
{% if has_organization_requests_flag %}
{% if has_organization_requests_flag and not hide_requests %}
<li class="usa-nav__primary-item">
<!-- user has one of the view permissions plus the edit permission, show the dropdown -->
{% if has_edit_request_portfolio_permission %}

View file

@ -130,10 +130,16 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
# If a user is creating a request, we assume that perms are handled upstream
if self.request.user.is_org_user(self.request):
portfolio = self.request.session.get("portfolio")
self._domain_request = DomainRequest.objects.create(
creator=self.request.user,
portfolio=self.request.session.get("portfolio"),
portfolio=portfolio,
)
# TODO - is this needed?
if portfolio:
self._domain_request.generic_org_type = portfolio.organization_type
self._domain_request.save()
else:
self._domain_request = DomainRequest.objects.create(creator=self.request.user)
@ -233,7 +239,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
# Clear context so the prop getter won't create a request here.
# Creating a request will be handled in the post method for the
# intro page.
return render(request, "domain_request_intro.html", {})
return render(request, "domain_request_intro.html", {"hide_requests": True, "hide_domains": True})
else:
return self.goto(self.steps.first)
@ -360,7 +366,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
# from the list of "unlocked" steps.
if self.is_portfolio:
history_dict = {
"requesting_entity": self.domain_request.is_policy_acknowledged is not None,
"requesting_entity": self.domain_request.organization_name is not None,
"current_sites": (
self.domain_request.current_websites.exists() or self.domain_request.requested_domain is not None
),
@ -459,6 +465,11 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
"user": self.request.user,
"requested_domain__name": requested_domain_name,
}
# Hides the requests and domains buttons in the navbar
context_stuff["hide_requests"] = self.is_portfolio
context_stuff["hide_domains"] = self.is_portfolio
return context_stuff
def get_step_list(self) -> list:

View file

@ -391,6 +391,12 @@ class DomainRequestWizardPermission(PermissionsLoginMixin):
if self.request.user.is_restricted():
return False
# If the user is an org user and doesn't have add/edit perms, forbid this
if self.request.user.is_org_user(self.request):
portfolio = self.request.session.get("portfolio")
if not self.request.user.has_edit_request_portfolio_permission(portfolio):
return False
# user needs to be the creator of the domain request to edit it.
id = self.kwargs.get("id") if hasattr(self, "kwargs") else None
if not id:
@ -398,12 +404,10 @@ class DomainRequestWizardPermission(PermissionsLoginMixin):
if domain_request_wizard:
id = domain_request_wizard.get("domain_request_id")
if not DomainRequest.objects.filter(creator=self.request.user, id=id).exists():
return False
if self.request.user.is_org_user(self.request):
portfolio = self.request.session.get("portfolio")
if not self.request.user.has_edit_request_portfolio_permission(portfolio):
# If no id is provided, we can assume that the user is starting a new request.
# If one IS provided, check that they are the original creator of it.
if id:
if not DomainRequest.objects.filter(creator=self.request.user, id=id).exists():
return False
return True