Skip to content

Commit

Permalink
Merge pull request #3607 from rebeccacremona/settings
Browse files Browse the repository at this point in the history
Split "settings" views into a separate module.
  • Loading branch information
rebeccacremona authored Oct 2, 2024
2 parents 731fb5c + 2765b5d commit 0e2177b
Show file tree
Hide file tree
Showing 22 changed files with 343 additions and 334 deletions.
4 changes: 2 additions & 2 deletions perma_web/perma/templates/docs/developer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ <h2 class="body-ah">API Overview</h2>
<h3 id="authentication" class="body-bh">Authentication</h3>
<p class="body-text">Many of the endpoints require you to authenticate with an API key.</p>
{% if request.user.get_api_key %}
<p class="body-text">Your <a href="{% url 'user_management_settings_tools' %}">API Key</a> is <code>{{ request.user.get_api_key }}</code>.</p>
<p class="body-text">Your <a href="{% url 'settings_tools' %}">API Key</a> is <code>{{ request.user.get_api_key }}</code>.</p>
{% else %}
<p class="body-text">
Find your API key in <a href="{% url 'user_management_settings_tools' %}">Settings > Tools</a>. Click the <i>Generate an API key</i> button to create a new key.
Find your API key in <a href="{% url 'settings_tools' %}">Settings > Tools</a>. Click the <i>Generate an API key</i> button to create a new key.
</p>
<img src="{{ STATIC_URL }}img/docs/create-api-key.png" class="img-responsive screen-shot" alt="Screenshot of Settings > Tools page. A button labeled 'Generate an API key' appears near the bottom of the page."/>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion perma_web/perma/templates/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h3 id="usage-plans" class="body-bh">Usage Plans</h3>
<p class="body-text">We also offer a variety of paid usage plans for other groups and for individuals. To learn more about paid usage plans, please visit the <a href="{% url 'docs_accounts' %}#usage-plans">Accounts and Usage Plans</a> portion of our user guide.</p>

<h3 id="creating-links" class="body-bh">Preserving records</h3>
<p class="body-text">To preserve a web page, log in to your account, enter the URL of the page you want to preserve and click the "Create Perma Link" button, or try one of our <a href="{% url 'user_management_settings_tools' %}">Browser Tools</a>. Perma will visit the web page at your direction and create a record of the contents of that page.</p>
<p class="body-text">To preserve a web page, log in to your account, enter the URL of the page you want to preserve and click the "Create Perma Link" button, or try one of our <a href="{% url 'settings_tools' %}">Browser Tools</a>. Perma will visit the web page at your direction and create a record of the contents of that page.</p>

<img src="{{ STATIC_URL }}img/docs/create_link.png" class="img-responsive screen-shot" alt="A screenshot of the Create a Perma Link page. A large input field for the target URL and a 'Create Perma Link' button appear prominently at the top of the page." />

Expand Down
2 changes: 1 addition & 1 deletion perma_web/perma/templates/docs/perma-link-creation.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h2 class="body-ah" id="creating-records">Creating Perma Records and Links</h2>
<p class="body-test">For example, this Perma Link - <a href="http://perma.cc/9265-T4NB" target="blank">http://perma.cc/9265-T4NB</a> - points to a Perma Record of the White House homepage on November 18, 2015.</p>

<h3 class="body-bh" id="web-page-preservation">Preservation Methods</h3>
<p class="body-text">To preserve a web page, login to your account, enter the URL of the page you want to preserve and click the "Create Perma Link" button, or try one of our <a href="{% url 'user_management_settings_tools' %}">Browser Tools</a>.</p>
<p class="body-text">To preserve a web page, login to your account, enter the URL of the page you want to preserve and click the "Create Perma Link" button, or try one of our <a href="{% url 'settings_tools' %}">Browser Tools</a>.</p>
<img src="{{ STATIC_URL }}img/docs/create_link.png" class="img-responsive screen-shot" alt="A screenshot of the Create a Perma Link page. A large input field for the target URL and a 'Create Perma Link' button appear prominently at the top of the page." />
<p class="body-text">Perma visits the URL, fetches the contents of the page, makes a record of those contents - a Perma Record - and deposits that record into the permanent collection. Perma also gives you a unique URL - a Perma Link - that's associated with the new Perma Record. </p>
<p class="body-text">When the capture process is done, Perma shows you the Perma Record so you can verify it. </p>
Expand Down
10 changes: 5 additions & 5 deletions perma_web/perma/templates/includes/upper_right_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ <h2 class="sr-only" id="upper_right_menu_name">Main Menu</h2>
{% endif %}
<li><h3 class="dropdown-header">Settings</h3>
<ul class="dropdown-inner-list">
<li><a href="{% url 'user_management_settings_profile' %}">Profile</a></li>
<li><a href="{% url 'user_management_settings_password' %}">Password</a></li>
<li><a href="{% url 'settings_profile' %}">Profile</a></li>
<li><a href="{% url 'settings_password' %}">Password</a></li>
{% if request.user.can_view_usage_plan %}
<li><a href="{% url 'user_management_settings_usage_plan' %}">Usage Plan</a></li>
<li><a href="{% url 'settings_usage_plan' %}">Usage Plan</a></li>
{% endif %}
<li><a href="{% url 'user_management_settings_tools' %}">Tools</a></li>
<li><a href="{% url 'settings_tools' %}">Tools</a></li>
{% if request.user.is_organization_user or request.user.is_registrar_user or request.user.has_registrar_pending %}
<li><a href="{% url 'user_management_settings_affiliations' %}">Your affiliations</a></li>
<li><a href="{% url 'settings_affiliations' %}">Your affiliations</a></li>
{% endif %}
</ul>
</li>
Expand Down
10 changes: 5 additions & 5 deletions perma_web/perma/templates/settings-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ <h1 class="page-title">Settings</h1>
<nav aria-label="Settings">
<ul class="nav nav-pills nav-stacked">

<li{% if this_page == 'settings_profile' %} class="active" aria-current="page"{% endif %}><a href="{% url 'user_management_settings_profile' %}"><span>Profile</span></a></li>
<li{% if this_page == 'settings_profile' %} class="active" aria-current="page"{% endif %}><a href="{% url 'settings_profile' %}"><span>Profile</span></a></li>

<li{% if this_page == 'settings_password' %} class="active" aria-current="page"{% endif %}><a href="{% url 'user_management_settings_password' %}"><span>Password</span></a></li>
<li{% if this_page == 'settings_password' %} class="active" aria-current="page"{% endif %}><a href="{% url 'settings_password' %}"><span>Password</span></a></li>

{% if request.user.can_view_usage_plan %}
<li{% if this_page == 'settings_usage_plan' %} class="active" aria-current="page"{% endif %}><a href="{% url 'user_management_settings_usage_plan' %}" id="dashboard-settings"><span>Usage Plan</span></a></li>
<li{% if this_page == 'settings_usage_plan' %} class="active" aria-current="page"{% endif %}><a href="{% url 'settings_usage_plan' %}" id="dashboard-settings"><span>Usage Plan</span></a></li>
{% endif %}

<li{% if this_page == 'settings_tools' %} class="active" aria-current="page"{% endif %}><a href="{% url 'user_management_settings_tools' %}"><span>Tools</span></a></li>
<li{% if this_page == 'settings_tools' %} class="active" aria-current="page"{% endif %}><a href="{% url 'settings_tools' %}"><span>Tools</span></a></li>

{% if request.user.is_organization_user or request.user.is_registrar_user or request.user.has_registrar_pending %}
<li{% if this_page == 'settings_affiliations' %} class="active" aria-current="page"{% endif %}><a href="{% url 'user_management_settings_affiliations' %}" id="dashboard-settings"><span>Your Affiliations</span></a></li>
<li{% if this_page == 'settings_affiliations' %} class="active" aria-current="page"{% endif %}><a href="{% url 'settings_affiliations' %}" id="dashboard-settings"><span>Your Affiliations</span></a></li>
{% endif %}

</ul><!--/#dashboard-tabs-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ <h3 class="body-bh">Change default privacy settings for all links in <strong>{{
{% csrf_token %}
{% if org.default_to_private %}
<p class="page-dek">Your Perma Links are currently <strong>Private</strong> by default.</p>
<a class="btn cancel" href="{% url 'user_management_settings_affiliations' %}">Cancel</a>
<a class="btn cancel" href="{% url 'settings_affiliations' %}">Cancel</a>
<button type="submit" class="btn">Set to Public</button>
{% else %}
<p class="page-dek">Your Perma Links are currently <strong>Public</strong> by default.</p>
<a class="btn cancel" href="{% url 'user_management_settings_affiliations' %}">Cancel</a>
<a class="btn cancel" href="{% url 'settings_affiliations' %}">Cancel</a>
<button type="submit" class="btn">Set to Private</button>
{% endif %}
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2 class="body-ah">Deletion Request Received</h2>
<h2 class="body-ah">Request Account Deletion</h2>
<p>On request, a team member will delete your Perma.cc account. It may take up to one full business day for us to process your request. Please note that the deletion of your account will not affect the visibility of any Perma Links you have created.</p>
<p>If you have any questions, please <a href="{% url 'contact' %}?subject=Question%20About%20Account%20Deletion">contact us</a>.</p>
<form method="post" action="{% url 'user_management_delete_account' %}">
<form method="post" action="{% url 'settings_delete_account' %}">
{% csrf_token %}
<button class="btn cancel" type="submit">
Please delete my account.
Expand Down
12 changes: 6 additions & 6 deletions perma_web/perma/templates/user_management/create-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ <h1 class="create-title">Create a new <span class="nobreak">Perma Link</span></h
{% if request.user.is_individual %}
<p class="links-remaining-message">
{% if subscription_status == 'problem' %}
Your subscription is on hold due to a <a href="{% url 'user_management_settings_usage_plan' %}">problem with your credit card</a>.<br>
Your subscription is on hold due to a <a href="{% url 'settings_usage_plan' %}">problem with your credit card</a>.<br>
{% endif %}
{% if links_remaining == 'Infinity' %}
{% if request.user.nonpaying %}
Your account has been upgraded to unlimited personal Perma Links.
{% else %}
Your <a href="{% url 'user_management_settings_usage_plan' %}">subscription</a> includes the creation of unlimited Perma Links.
Your <a href="{% url 'settings_usage_plan' %}">subscription</a> includes the creation of unlimited Perma Links.
{% endif %}
{% else %}
You have <span class="links-remaining">{{ links_remaining }}</span> remaining Perma Links{% if links_remaining_period == "monthly" %} this month{% elif links_remaining_period == "annually" %} this year{% endif %}.
{% if not request.user.nonpaying and not subscription_status == 'problem' %}
<br><a href="{% url 'user_management_settings_usage_plan' %}">View your subscription details or get more Perma Links</a>
<br><a href="{% url 'settings_usage_plan' %}">View your subscription details or get more Perma Links</a>
{% endif %}
{% endif %}
</p>
Expand All @@ -77,16 +77,16 @@ <h1 class="create-title">Create a new <span class="nobreak">Perma Link</span></h
</div>
<p id="personal-links-banner" class="hide">
{% if subscription_status == 'problem' %}
<a href="{% url 'user_management_settings_usage_plan' %}">Your account is on hold</a>.<br>
<a href="{% url 'settings_usage_plan' %}">Your account is on hold</a>.<br>
{% elif links_remaining != 'Infinity' and not request.user.nonpaying %}
get <a href="{% url 'user_management_settings_usage_plan' %}">more personal links</a>
get <a href="{% url 'settings_usage_plan' %}">more personal links</a>
{% endif %}
</p>
{% endif %}
</fieldset>
{% if suppress_reminder != 'true' %}
<p id="browser-tools-message" class="limit-{% if request.user.is_individual %}true{% else %}false{% endif %}">
To make Perma links more quickly, try our <a href="{% url 'user_management_settings_tools' %}">browser tools</a>.
To make Perma links more quickly, try our <a href="{% url 'settings_tools' %}">browser tools</a>.
<button type="button" class="close-browser-tools btn-link">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ <h3 class="body-bh">Edit organization</h3>
<div class="settings-block">
{% if target_org.default_to_private %}
<p>Links are <strong>Private</strong> by default</p>
<a href="{% url 'user_management_settings_organizations_change_privacy' target_org.id %}" class="btn btn-default btn-xs leave-org-btn" role="button">Set to public</a>
<a href="{% url 'settings_organizations_change_privacy' target_org.id %}" class="btn btn-default btn-xs leave-org-btn" role="button">Set to public</a>
{% else %}
<p>Links are <strong>Public</strong> by default</p>
<a href="{% url 'user_management_settings_organizations_change_privacy' target_org.id %}" class="btn btn-default btn-xs leave-org-btn" role="button">Set to private</a>
<a href="{% url 'settings_organizations_change_privacy' target_org.id %}" class="btn btn-default btn-xs leave-org-btn" role="button">Set to private</a>
{% endif %}
</div>
<form method="post" action="">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h3 class="body-bh">Leave {{ org.name }}</h3>
<div class="alert alert-danger">You will lose your sharing privileges <strong>{{ org.name }}</strong>.</div>
<form action="" method="POST">
{% csrf_token %}
<a class="btn cancel" href="{% url 'user_management_settings_affiliations' %}">Cancel</a>
<a class="btn cancel" href="{% url 'settings_affiliations' %}">Cancel</a>
<button type="submit" class="btn delete-confirm">Leave {{ org.name }} forever</button>
</form>

Expand Down
6 changes: 3 additions & 3 deletions perma_web/perma/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def test_permissions(client, admin_user, registrar_user, org_user, link_user_fac

{
'urls': [
['user_management_settings_profile'],
['user_management_settings_password'],
['user_management_settings_tools'],
['settings_profile'],
['settings_password'],
['settings_tools'],
['create_link'],
['user_delete_link', {'kwargs':{'guid':'1234-1234'},'success_status':404}],
],
Expand Down
Loading

0 comments on commit 0e2177b

Please sign in to comment.