Skip to content

Commit

Permalink
Merge pull request #381 from cisagov/ik/dynamic-helper-text-2
Browse files Browse the repository at this point in the history
Dynamic example text – part 2
  • Loading branch information
igorkorenfeld committed Jan 25, 2023
2 parents 1a52664 + 7b58242 commit 34c3ca5
Show file tree
Hide file tree
Showing 17 changed files with 245 additions and 82 deletions.
24 changes: 1 addition & 23 deletions src/registrar/templates/application_authorizing_official.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,7 @@ <h2>Who is the authorizing official for your organization?</h2>
</p>

<div class="ao_example">
{% if is_federal %}
{% if federal_type == 'executive' %}
{% include "includes/ao_example__exec.html" %}
{% elif federal_type == 'judicial' %}
{% include "includes/ao_example__judicial.html" %}
{% elif federal_type == 'legislative' %}
{% include "includes/ao_example__legislative.html" %}
{% endif %}
{% elif organization_type == 'city' %}
{% include "includes/ao_example__city.html" %}
{% elif organization_type == 'county' %}
{% include "includes/ao_example__county.html" %}
{% elif organization_type == 'interstate' %}
{% include "includes/ao_example__interstate.html" %}
{% elif organization_type == 'school_district' %}
{% include "includes/ao_example__school-district.html" %}
{% elif organization_type == 'special_district' %}
{% include "includes/ao_example__special-district.html" %}
{% elif organization_type == 'state_or_territory' %}
{% include "includes/ao_example__state-territory.html" %}
{% elif organization_type == 'tribal' %}
{% include "includes/ao_example__tribal.html" %}
{% endif %}
{% include "includes/ao_example.html" %}
</div>

<p>We’ll contact your authorizing official to let them know that you made this request and to double check that they approve it.</p>
Expand Down
4 changes: 2 additions & 2 deletions src/registrar/templates/application_dotgov_domain.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<p>We’ll try to give you the domain you want. We first need to make sure your request meets our requirements. We’ll work with you to find the best domain for your organization.</p>

<p>Here are a few domain examples for your type of organization.</p>
<div id="domain-example">
{% include "includes/domain_example__city.html" %}
<div class="domain-example">
{% include "includes/domain_example.html" %}
</div>
</div>

Expand Down
49 changes: 49 additions & 0 deletions src/registrar/templates/includes/ao_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% if is_federal %}
{% if federal_type == 'executive' %}
<p>Domain requests from executive branch agencies must be authorized by <strong>Chief Information Officers</strong> or <strong>agency heads</strong>.</p>
<p>Domain requests from executive branch agencies are subject to guidance issued by the U.S. Office of Management and Budget. </p>

{% elif federal_type == 'judicial' %}
<p>Domain requests from the U.S. Supreme Court must be authorized by the <strong>director of information technology for the U.S. Supreme Court.</strong></p>
<p>Domain requests from other judicial branch agencies must be authorized by the <strong>director</strong> or <strong>Chief Information Officer of the Administrative Office (AO)</strong> of the United States Courts.
</p>

{% elif federal_type == 'legislative' %}
<h3> U.S. Senate </h3>
<p>Domain requests from the U.S. Senate must come from the <strong>Senate Sergeant at Arms.</strong></p>

<h3> U.S. House of Representatives </h3>
<p class="">Domain requests from the U.S. House of Representatives must come from the <strong>House Chief Administrative Officer.</strong>

<h3> Other legislative branch agencies </h3>
<p class="margin-top-1">Domain requests from legislative branch agencies must come from the <strong>agency’s head</strong> or <strong>Chief Information Officer.</strong></p>
<p class="margin-top-1">Domain requests from legislative commissions must come from the <strong>head of the commission</strong>, or the <strong>head or Chief Information Officer of the parent agency,</strong> if there is one.
</p>

{% endif %}

{% elif organization_type == 'city' %}
<p>Domain requests from cities must be authorized by <strong>the mayor</strong> or the equivalent <strong>highest elected official.</strong></p>

{% elif organization_type == 'county' %}
<p>Domain requests from counties must be authorized by the <strong>chair of the county commission </strong>or <strong>the equivalent highest elected official.</strong></p>

{% elif organization_type == 'interstate' %}
<p>Domain requests from interstate organizations must be authorized by the <strong>highest-ranking executive</strong> (president, director, chair, or equivalent) or <strong>one of the state’s governors or Chief Information Officers.</strong></p>

{% elif organization_type == 'school_district' %}
<p>Domain requests from school district governments must be authorized by the <strong>highest-ranking executive (the chair of a school district’s board or a superintendent)</strong>.</p>

{% elif organization_type == 'special_district' %}
<p>Domain requests from special districts must be authorized by the <strong>highest-ranking executive (president, director, chair, or equivalent)</strong> or <strong>state Chief Information Officers for state-based organizations</strong>.</p>

{% elif organization_type == 'state_or_territory' %}
<h3>States and territories: executive branch</h3>
<p>Domain requests from states and territories must be authorized by the <strong>governor</strong> or the <strong>state Chief Information Officer.</strong></p>
<h3>States and territories: judicial and legislative branches</h3>
<p>Domain requests from state legislatures and courts must be authorized by an agency’s <strong>Chief Information Officer</strong> or <strong>highest-ranking executive</strong>.</p>

{% elif organization_type == 'tribal' %}
<p>Domain requests from federally-recognized tribal governments must be authorized by <strong>the leader of the tribe</strong>, as recognized by the as noted by the <a href="https://www.bia.gov/service/tribal-leaders-directory" class="usa-link"> Bureau of Indian Affairs.</a></p>

{% endif %}
1 change: 0 additions & 1 deletion src/registrar/templates/includes/ao_example__city.html

This file was deleted.

2 changes: 0 additions & 2 deletions src/registrar/templates/includes/ao_example__county.html

This file was deleted.

3 changes: 0 additions & 3 deletions src/registrar/templates/includes/ao_example__exec.html

This file was deleted.

2 changes: 0 additions & 2 deletions src/registrar/templates/includes/ao_example__interstate.html

This file was deleted.

4 changes: 0 additions & 4 deletions src/registrar/templates/includes/ao_example__judicial.html

This file was deleted.

10 changes: 0 additions & 10 deletions src/registrar/templates/includes/ao_example__legislative.html

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions src/registrar/templates/includes/ao_example__tribal.html

This file was deleted.

94 changes: 94 additions & 0 deletions src/registrar/templates/includes/domain_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{% if is_federal %}
{% if federal_type == 'executive' %}
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> medicare.gov </li>
<li> fema.gov </li>
</ul>

{% elif federal_type == 'judicial' %}
<p><strong>Examples:</strong></p>
<p>
<ul class="usa-list">
<li> usprobation.gov </li>
<li> ustaxcourt.gov </li>
</ul>
</p>

{% elif federal_type == 'legislative' %}
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> capitol.gov </li>
<li> gpo.gov </li>
</ul>
{% endif %}

{% elif organization_type == 'interstate' %}
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> GulfCoastWaterAuthority.gov </li>
<li> wmataOIG.gov </li>
</ul>

{% elif organization_type == 'state_or_territory' %}
<p>State .gov domains must include the two-letter state abbreviation or clearly spell out the state name.</p>
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> UtahGovernor.gov </li>
<li> ColoradoDOT.gov </li>
<li> NJRecycling.gov </li>
<li> AmericanSamoa.gov </li>
<li> Guam.gov </li>
</ul>

{% elif organization_type == 'tribal' %}
<p>Tribal domains may include the suffix -nsn, for native sovereign nation.</p>
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> tbyi.gov </li>
<li> pitu.gov </li>
<li> TulalipTribalCourt-nsn.gov </li>
</ul>

{% elif organization_type == 'county' %}
<p>Most county .gov domains must include the two-letter state abbreviation or the full state name. County names that aren’t shared by any other city, county, parish, town, borough, village or equivalent in the U.S., at the time a domain is granted, can be requested without referring to the state. Counties can include “county” in their domain to distinguish it from other places with similar names. We use the Census Bureau’s National Places Gazetteer Files to determine if county names are unique.</p>
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> AdamsCountyMS.gov </li>
<li> LivingstonParishLA.gov </li>
<li> Erie.gov </li>
</ul>

{% elif organization_type == 'city' %}
<p> Most city domains must include the two-letter state abbreviation or clearly spell out the state name. Using phrases like “City of” or “Town of” is optional.</p>
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li>www.BlufftonIndiana.gov</li>
<li>www.CityofEudoraKS.gov</li>
<li>www.WallawallaWA.gov</li>
</ul>
<p> Some cities don’t have to refer to their state.
<ul class="usa-list">
<li> City names that are not shared by any other U.S. city, town, or village can be requested without referring to the state. We use the Census Bureau’s National Places Gazetteer Files to determine if names are unique. </li>
<li>Certain cities are so well-known that they may not require a state reference to communicate location. We use the list of U.S. “dateline cities” in the Associated Press Stylebook to make this determination.</li>
<li>The 50 largest cities, as measured by population according to the Census Bureau, can have .gov domain names that don’t refer to their state.</li>
</ul>
</p>

{% elif organization_type == 'special_district' %}
<p>Domain names must represent your organization or institutional name, not solely the services you provide. It also needs to include your two-letter state abbreviation or clearly spell out the state name.</p>
<p><strong>Examples:</strong></p>
<ul class="usa-list">
<li> GlacierViewFire.gov </li>
<li> LorainCountyRecorder.gov </li>
<li> CentreCountyVotes.gov </li>
<li> WalnutValleyWater.gov </li>
</ul>

{% elif organization_type == 'school_district' %}
<p>Domain names must represent your organization or institutional name.</p>
<p><strong>Example:</strong> mckinneyISDTX.gov </p>


{%endif %}

15 changes: 0 additions & 15 deletions src/registrar/templates/includes/domain_example__city.html

This file was deleted.

95 changes: 92 additions & 3 deletions src/registrar/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,15 +805,104 @@ def test_application_ao_dynamic_text(self):
ao_page = election_page.click(str(self.TITLES["authorizing_official"]), index=0)
self.assertContains(ao_page, "Domain requests from cities")

def test_application_formsets(self):
"""Users are able to add more than one of some fields."""
current_sites_page = self.app.get(reverse("application:current_sites"))
def test_application_dotgov_domain_dynamic_text(self):
type_page = self.app.get(reverse("application:")).follow()
# django-webtest does not handle cookie-based sessions well because it keeps
# resetting the session key on each new request, thus destroying the concept
# of a "session". We are going to do it manually, saving the session ID here
# and then setting the cookie on each request.
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
# ---- TYPE PAGE ----
type_form = type_page.form
type_form["organization_type-organization_type"] = "federal"

# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_page.form.submit()

# ---- FEDERAL BRANCH PAGE ----
# Follow the redirect to the next form page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
federal_page = type_result.follow()
federal_form = federal_page.form
federal_form["organization_federal-federal_type"] = "executive"
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
federal_result = federal_form.submit()

# ---- ORG CONTACT PAGE ----
# Follow the redirect to the next form page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
org_contact_page = federal_result.follow()
org_contact_form = org_contact_page.form
# federal agency so we have to fill in federal_agency
org_contact_form[
"organization_contact-federal_agency"
] = "General Services Administration"
org_contact_form["organization_contact-organization_name"] = "Testorg"
org_contact_form["organization_contact-address_line1"] = "address 1"
org_contact_form["organization_contact-address_line2"] = "address 2"
org_contact_form["organization_contact-city"] = "NYC"
org_contact_form["organization_contact-state_territory"] = "NY"
org_contact_form["organization_contact-zipcode"] = "10002"
org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks"

self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
org_contact_result = org_contact_form.submit()

# ---- AO CONTACT PAGE ----
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_page = org_contact_result.follow()

# ---- AUTHORIZING OFFICIAL PAGE ----
# Follow the redirect to the next form page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_page = org_contact_result.follow()
ao_form = ao_page.form
ao_form["authorizing_official-first_name"] = "Testy ATO"
ao_form["authorizing_official-last_name"] = "Tester ATO"
ao_form["authorizing_official-title"] = "Chief Tester"
ao_form["authorizing_official-email"] = "testy@town.com"
ao_form["authorizing_official-phone"] = "(201) 555 5555"

self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_result = ao_form.submit()

# ---- CURRENT SITES PAGE ----
# Follow the redirect to the next form page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
current_sites_page = ao_result.follow()
current_sites_form = current_sites_page.form
current_sites_form["current_sites-0-website"] = "www.city.com"

# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
current_sites_result = current_sites_form.submit()

# ---- DOTGOV DOMAIN PAGE ----
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
dotgov_page = current_sites_result.follow()

self.assertContains(dotgov_page, "medicare.gov")

# Go back to organization type page and change type
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
dotgov_page.click(str(self.TITLES["organization_type"]), index=0)
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_form["organization_type-organization_type"] = "city"
type_result = type_form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
election_page = type_result.follow()

# Go back to dotgov domain page to test the dynamic text changed
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
dotgov_page = election_page.click(str(self.TITLES["dotgov_domain"]), index=0)
self.assertContains(dotgov_page, "BlufftonIndiana.gov")
self.assertNotContains(dotgov_page, "medicare.gov")

def test_application_formsets(self):
"""Users are able to add more than one of some fields."""
current_sites_page = self.app.get(reverse("application:current_sites"))
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
# fill in the form field
current_sites_form = current_sites_page.form
self.assertIn("current_sites-0-website", current_sites_form.fields)
Expand Down

0 comments on commit 34c3ca5

Please sign in to comment.