From 2765b5d217054ef33901a4e4e35f76076c696f1c Mon Sep 17 00:00:00 2001
From: Rebecca Cremona
Date: Wed, 2 Oct 2024 11:07:22 -0400
Subject: [PATCH] Split "settings" views into a separate module.
---
.../perma/templates/docs/developer/index.html | 4 +-
perma_web/perma/templates/docs/index.html | 2 +-
.../templates/docs/perma-link-creation.html | 2 +-
.../templates/includes/upper_right_menu.html | 10 +-
.../perma/templates/settings-layout.html | 10 +-
.../settings-affiliations.html | 0
...settings-organizations-change-privacy.html | 4 +-
.../settings-password.html | 0
.../settings-profile.html | 2 +-
.../settings-subscription-cancel-confirm.html | 0
.../settings-subscription-update.html | 0
.../settings-tools.html | 0
.../settings-usage-plan-unavailable.html | 0
.../settings-usage-plan.html | 0
.../user_management/create-link.html | 12 +-
.../manage_single_organization.html | 4 +-
.../user_management/user_leave_confirm.html | 2 +-
perma_web/perma/tests/test_permissions.py | 6 +-
.../perma/tests/test_views_user_management.py | 114 ++++----
perma_web/perma/urls.py | 24 +-
perma_web/perma/views/user_management.py | 247 +-----------------
perma_web/perma/views/user_settings.py | 234 +++++++++++++++++
22 files changed, 343 insertions(+), 334 deletions(-)
rename perma_web/perma/templates/{user_management => settings}/settings-affiliations.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-organizations-change-privacy.html (78%)
rename perma_web/perma/templates/{user_management => settings}/settings-password.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-profile.html (96%)
rename perma_web/perma/templates/{user_management => settings}/settings-subscription-cancel-confirm.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-subscription-update.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-tools.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-usage-plan-unavailable.html (100%)
rename perma_web/perma/templates/{user_management => settings}/settings-usage-plan.html (100%)
create mode 100644 perma_web/perma/views/user_settings.py
diff --git a/perma_web/perma/templates/docs/developer/index.html b/perma_web/perma/templates/docs/developer/index.html
index bbd6509e7..31f4068fb 100644
--- a/perma_web/perma/templates/docs/developer/index.html
+++ b/perma_web/perma/templates/docs/developer/index.html
@@ -34,10 +34,10 @@ API Overview
Authentication
Many of the endpoints require you to authenticate with an API key.
{% if request.user.get_api_key %}
- Your API Key is {{ request.user.get_api_key }}
.
+ Your API Key is {{ request.user.get_api_key }}
.
{% else %}
- Find your API key in Settings > Tools . Click the Generate an API key button to create a new key.
+ Find your API key in Settings > Tools . Click the Generate an API key button to create a new key.
{% endif %}
diff --git a/perma_web/perma/templates/docs/index.html b/perma_web/perma/templates/docs/index.html
index eedde4f81..02919063f 100644
--- a/perma_web/perma/templates/docs/index.html
+++ b/perma_web/perma/templates/docs/index.html
@@ -90,7 +90,7 @@ Usage Plans
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 Accounts and Usage Plans portion of our user guide.
Preserving records
- 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 Browser Tools . Perma will visit the web page at your direction and create a record of the contents of that page.
+ 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 Browser Tools . Perma will visit the web page at your direction and create a record of the contents of that page.
diff --git a/perma_web/perma/templates/docs/perma-link-creation.html b/perma_web/perma/templates/docs/perma-link-creation.html
index 7f728a8b6..5277b0aad 100644
--- a/perma_web/perma/templates/docs/perma-link-creation.html
+++ b/perma_web/perma/templates/docs/perma-link-creation.html
@@ -71,7 +71,7 @@ Creating Perma Records and Links
For example, this Perma Link - http://perma.cc/9265-T4NB - points to a Perma Record of the White House homepage on November 18, 2015.
Preservation Methods
- 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 Browser Tools .
+ 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 Browser Tools .
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.
When the capture process is done, Perma shows you the Perma Record so you can verify it.
diff --git a/perma_web/perma/templates/includes/upper_right_menu.html b/perma_web/perma/templates/includes/upper_right_menu.html
index 4e34d533a..9c8a2b84f 100644
--- a/perma_web/perma/templates/includes/upper_right_menu.html
+++ b/perma_web/perma/templates/includes/upper_right_menu.html
@@ -53,14 +53,14 @@
{% endif %}
diff --git a/perma_web/perma/templates/settings-layout.html b/perma_web/perma/templates/settings-layout.html
index f8a036cf1..761f78fc2 100644
--- a/perma_web/perma/templates/settings-layout.html
+++ b/perma_web/perma/templates/settings-layout.html
@@ -18,18 +18,18 @@ Settings
diff --git a/perma_web/perma/templates/user_management/settings-affiliations.html b/perma_web/perma/templates/settings/settings-affiliations.html
similarity index 100%
rename from perma_web/perma/templates/user_management/settings-affiliations.html
rename to perma_web/perma/templates/settings/settings-affiliations.html
diff --git a/perma_web/perma/templates/user_management/settings-organizations-change-privacy.html b/perma_web/perma/templates/settings/settings-organizations-change-privacy.html
similarity index 78%
rename from perma_web/perma/templates/user_management/settings-organizations-change-privacy.html
rename to perma_web/perma/templates/settings/settings-organizations-change-privacy.html
index 2fd8ca285..50c1c72e3 100644
--- a/perma_web/perma/templates/user_management/settings-organizations-change-privacy.html
+++ b/perma_web/perma/templates/settings/settings-organizations-change-privacy.html
@@ -9,11 +9,11 @@ Change default privacy settings for all links in {{
{% csrf_token %}
{% if org.default_to_private %}
Your Perma Links are currently Private by default.
- Cancel
+ Cancel
Set to Public
{% else %}
Your Perma Links are currently Public by default.
- Cancel
+ Cancel
Set to Private
{% endif %}
diff --git a/perma_web/perma/templates/user_management/settings-password.html b/perma_web/perma/templates/settings/settings-password.html
similarity index 100%
rename from perma_web/perma/templates/user_management/settings-password.html
rename to perma_web/perma/templates/settings/settings-password.html
diff --git a/perma_web/perma/templates/user_management/settings-profile.html b/perma_web/perma/templates/settings/settings-profile.html
similarity index 96%
rename from perma_web/perma/templates/user_management/settings-profile.html
rename to perma_web/perma/templates/settings/settings-profile.html
index 7bd0d3db8..84f043adc 100644
--- a/perma_web/perma/templates/user_management/settings-profile.html
+++ b/perma_web/perma/templates/settings/settings-profile.html
@@ -33,7 +33,7 @@ Deletion Request Received
Request Account Deletion
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.
If you have any questions, please contact us .
-
@@ -77,16 +77,16 @@ Create a new Perma Link
{% if subscription_status == 'problem' %}
- Your account is on hold .
+ Your account is on hold .
{% elif links_remaining != 'Infinity' and not request.user.nonpaying %}
- get more personal links
+ get more personal links
{% endif %}
{% endif %}
{% if suppress_reminder != 'true' %}
- To make Perma links more quickly, try our browser tools .
+ To make Perma links more quickly, try our browser tools .
×
Close
diff --git a/perma_web/perma/templates/user_management/manage_single_organization.html b/perma_web/perma/templates/user_management/manage_single_organization.html
index e6338aeeb..9056e4534 100644
--- a/perma_web/perma/templates/user_management/manage_single_organization.html
+++ b/perma_web/perma/templates/user_management/manage_single_organization.html
@@ -10,10 +10,10 @@ Edit organization
diff --git a/perma_web/perma/tests/test_permissions.py b/perma_web/perma/tests/test_permissions.py
index 3e1e7af63..f1d5b7c75 100644
--- a/perma_web/perma/tests/test_permissions.py
+++ b/perma_web/perma/tests/test_permissions.py
@@ -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}],
],
diff --git a/perma_web/perma/tests/test_views_user_management.py b/perma_web/perma/tests/test_views_user_management.py
index f0e625faa..8a8adcad7 100644
--- a/perma_web/perma/tests/test_views_user_management.py
+++ b/perma_web/perma/tests/test_views_user_management.py
@@ -220,7 +220,7 @@ def test_registrar_can_update_registrar(self):
'a-name': 'new_name',
'a-email': 'test@test.com2',
'a-website': 'http://test.com'},
- success_url=reverse('user_management_settings_affiliations'),
+ success_url=reverse('settings_affiliations'),
success_query=Registrar.objects.filter(name='new_name'))
def test_registrar_cannot_update_unrelated_registrar(self):
@@ -804,7 +804,7 @@ def test_org_user_can_leave_org(self):
user=u,
data={},
reverse_kwargs={'args': [orgs[0].pk]},
- success_url=reverse('user_management_settings_affiliations'))
+ success_url=reverse('settings_affiliations'))
# returns to create/manage page if no longer a member of any orgs
self.submit_form('user_management_organization_user_leave_organization',
@@ -1260,7 +1260,7 @@ def test_can_remove_self_from_admin(self):
### SETTINGS ###
def test_user_can_change_own_settings(self):
- response = self.submit_form('user_management_settings_profile',
+ response = self.submit_form('settings_profile',
user=self.admin_user,
data={
'a-first_name': 'Newfirst',
@@ -1272,12 +1272,12 @@ def test_user_can_change_own_settings(self):
self.assertIn(bytes('Profile saved!', 'utf-8'), response.content)
def test_user_can_request_deletion_once(self):
- deletion_url = reverse('user_management_delete_account')
+ deletion_url = reverse('settings_delete_account')
self.assertNotIn('Requested account deletion', self.regular_user.notes)
- response1 = self.get('user_management_settings_profile',
+ response1 = self.get('settings_profile',
user=self.regular_user).content
self.assertIn(bytes('