Skip to content

Commit 1517e12

Browse files
authored
Project: merge basic and advanced forms (#11169)
* Project: merge basic and advanced forms Closes #11084 * Fix tests * Remove banner and re-order the form fields * Remove from navbar * Lint * Link to new page * Update docs * Fix tests on .com? * Uppercase
1 parent b9d9cf0 commit 1517e12

20 files changed

+116
-134
lines changed

docs/user/analytics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Enabling Google Analytics on your project
3535
Read the Docs has native support for Google Analytics.
3636
You can enable it by:
3737

38-
* Going to :guilabel:`Admin` > :guilabel:`Advanced Settings` in your project.
38+
* Going to :guilabel:`Admin` > :guilabel:`Settings` in your project.
3939
* Fill in the **Analytics code** heading with your Google Tracking ID (example `UA-123456674-1`)
4040

4141
.. figure:: /_static/images/google-analytics-options.png
@@ -65,7 +65,7 @@ Disabling Google Analytics on your project
6565
Google Analytics can be completely disabled on your own projects.
6666
To disable Google Analytics:
6767

68-
* Going to :guilabel:`Admin` > :guilabel:`Advanced Settings` in your project.
68+
* Going to :guilabel:`Admin` > :guilabel:`Settings` in your project.
6969
* Check the box **Disable Analytics**.
7070

7171
Your documentation will need to be rebuilt for this change to take effect.

docs/user/commercial/privacy-level.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ By default, only users that belong to your organization can see the dashboard of
1111
If you want users outside your organization and anonymous users to be able to see the dashboard of your project,
1212
and the build output of *public versions* you can set the privacy level of your project to ``Public``.
1313

14-
You can administer this in your :term:`dashboard` by navigating to :menuselection:`Admin --> Advanced Settings`
14+
You can administer this in your :term:`dashboard` by navigating to :menuselection:`Admin --> Settings`
1515
and changing :guilabel:`Privacy level` to `Public`.
1616

1717
.. note::

docs/user/guides/build-troubleshooting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ terminal prompts disabled
1818
1919
fatal: could not read Username for 'https://github.com': terminal prompts disabled
2020
21-
**Resolution:** This error can be quite misleading. It usually occurs when a repository could not be found because of a typo in the reposistory name or because the repository has been deleted. Verify your repository URL in :guilabel:`Admin > Advanced Settings`.
21+
**Resolution:** This error can be quite misleading. It usually occurs when a repository could not be found because of a typo in the reposistory name or because the repository has been deleted. Verify your repository URL in :guilabel:`Admin > Settings`.
2222

2323
This error also occurs if you have changed a ``public`` repository to ``private`` and you are using ``https://`` in your git repository URL.
2424

@@ -35,7 +35,7 @@ error: pathspec
3535
error: pathspec 'main' did not match any file(s) known to git
3636
3737
**Resolution:** A specified branch does not exist in the git repository.
38-
This might be because the git repository was recently created (and has no commits nor branches) or because the default branch has changed name. If for instance, the default branch on GitHub changed from ``master`` to ``main``, you need to visit :guilabel:`Admin > Advanced Settings` to change the name of the default branch that Read the Docs expects to find when cloning the repository.
38+
This might be because the git repository was recently created (and has no commits nor branches) or because the default branch has changed name. If for instance, the default branch on GitHub changed from ``master`` to ``main``, you need to visit :guilabel:`Admin > Settings` to change the name of the default branch that Read the Docs expects to find when cloning the repository.
3939

4040

4141
Permission denied (publickey)

docs/user/guides/pull-requests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ See `Limitations`_ for more information.
1010
If your account is already connected:
1111

1212
#. Go to your project dashboard
13-
#. Go to :guilabel:`Admin`, then :guilabel:`Advanced settings`
13+
#. Go to :guilabel:`Admin`, then :guilabel:`Settings`
1414
#. Enable the :guilabel:`Build pull requests for this project` option
1515
#. Click on :guilabel:`Save`
1616

@@ -43,7 +43,7 @@ while private previews are only available to users with access to the Read the D
4343
To change the privacy level:
4444

4545
#. Go to your project dashboard
46-
#. Go to :guilabel:`Admin`, then :guilabel:`Advanced settings`
46+
#. Go to :guilabel:`Admin`, then :guilabel:`Settings`
4747
#. Select your option in :guilabel:`Privacy level of builds from pull requests`
4848
#. Click on :guilabel:`Save`
4949

docs/user/guides/setup/monorepo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Setting the custom build configuration file
4545
-------------------------------------------
4646

4747
Once you have added a Git repository to a project that needs a custom configuration file path,
48-
navigate to :menuselection:`Admin --> Advanced Settings` and add the path to the :guilabel:`Build configuration file` field.
48+
navigate to :menuselection:`Admin --> Settings` and add the path to the :guilabel:`Build configuration file` field.
4949

5050
.. image:: /img/screenshot-howto-build-configuration-file.png
5151
:alt: Screenshot of where to find the :guilabel:`Build configuration file` setting.

docs/user/guides/setup/versioning-schemes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Changing the versioning scheme
1919
------------------------------
2020

2121
#. Go the :guilabel:`Admin` tab of your project.
22-
#. Click on :guilabel:`Advanced Settings`.
22+
#. Click on :guilabel:`Settings`.
2323
#. Select the new versioning scheme in the :guilabel:`Versioning scheme` dropdown.
2424
#. Click on :guilabel:`Save`.

docs/user/tutorial/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Trigger a build from a pull request
237237
Read the Docs allows you to :doc:`trigger builds from GitHub pull requests </pull-requests>`
238238
and gives you a preview of how the documentation would look like with those changes.
239239

240-
To enable that functionality, first click on the :guilabel:`Advanced Settings` link on the left
240+
To enable that functionality, first click on the :guilabel:`Settings` link on the left
241241
under the :guilabel:`⚙ Admin` menu, check the "Build pull requests for this project" checkbox,
242242
and click the :guilabel:`Save` button at the bottom of the page.
243243

@@ -520,7 +520,7 @@ so that users see the ``stable`` documentation
520520
when they visit the :term:`root URL` of your documentation
521521
(while still being able to change the version in the flyout menu).
522522

523-
For that, go to the :guilabel:`Advanced Settings` link
523+
For that, go to the :guilabel:`Settings` link
524524
under the :guilabel:`⚙ Admin` menu of your project home,
525525
choose ``stable`` in the "Default version*" dropdown,
526526
and hit :guilabel:`Save` at the bottom.
@@ -579,7 +579,7 @@ and a new build will be triggered for it.
579579
580580
From this point, ``1.0.x`` version is no longer the most up to date one.
581581
To display a warning to your readers, go to the :guilabel:`⚙ Admin` menu of your project home,
582-
click on the :guilabel:`Advanced Settings` link on the left,
582+
click on the :guilabel:`Settings` link on the left,
583583
enable the "Show version warning" checkbox, and click the :guilabel:`Save` button.
584584
585585
If you now browse the ``1.0.x`` documentation, you will see a warning on top

docs/user/versions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ a more stable version of the documentation available. Specifically:
161161

162162

163163
This feature is enabled by default on projects using the new beta addons.
164-
The beta addons can be enabled by using ``build.commands`` config key or via the new beta dashboard (https://beta.readthedocs.org) going to the admin section of your docs (:guilabel:`Admin` > :guilabel:`Advanced Settings`)
164+
The beta addons can be enabled by using ``build.commands`` config key or via the new beta dashboard (https://beta.readthedocs.org) going to the admin section of your docs (:guilabel:`Admin` > :guilabel:`Settings`)
165165

166166
.. note::
167167

readthedocs/core/tests/test_history.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def test_extra_historical_fields_with_request(self):
2323
"name": "Changed!",
2424
"repo": "https://github.com/readthedocs/readthedocs",
2525
"repo_type": self.project.repo_type,
26+
"default_version": self.project.default_version,
2627
"language": self.project.language,
28+
"versioning_scheme": self.project.versioning_scheme,
2729
},
2830
headers={"user-agent": "Firefox"},
2931
)

readthedocs/projects/forms.py

Lines changed: 38 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def clean_prevalidation(self):
190190

191191
class ProjectBasicsForm(ProjectForm):
192192

193-
"""Form for basic project fields."""
193+
"""Form used when importing a project."""
194194

195195
class Meta:
196196
model = Project
@@ -264,39 +264,6 @@ def placehold_repo(self):
264264
)
265265

266266

267-
class ProjectExtraForm(ProjectForm):
268-
269-
"""Additional project information form."""
270-
271-
class Meta:
272-
model = Project
273-
fields = (
274-
"description",
275-
"documentation_type",
276-
"language",
277-
"programming_language",
278-
"tags",
279-
"project_url",
280-
)
281-
282-
description = forms.CharField(
283-
required=False,
284-
max_length=150,
285-
widget=forms.Textarea,
286-
)
287-
288-
def clean_tags(self):
289-
tags = self.cleaned_data.get("tags", [])
290-
for tag in tags:
291-
if len(tag) > 100:
292-
raise forms.ValidationError(
293-
_(
294-
"Length of each tag must be less than or equal to 100 characters.",
295-
),
296-
)
297-
return tags
298-
299-
300267
class ProjectConfigForm(forms.Form):
301268

302269
"""Simple intermediate step to communicate about the .readthedocs.yaml file."""
@@ -307,28 +274,47 @@ def __init__(self, *args, **kwargs):
307274
super().__init__(*args, **kwargs)
308275

309276

310-
class ProjectAdvancedForm(ProjectTriggerBuildMixin, ProjectForm):
277+
class UpdateProjectForm(
278+
ProjectTriggerBuildMixin,
279+
ProjectBasicsForm,
280+
):
311281

312-
"""Advanced project option form."""
282+
"""Main project settings form."""
313283

314284
class Meta:
315285
model = Project
316286
fields = (
317-
"default_version",
287+
# Basics and repo settings
288+
"name",
289+
"repo",
290+
"repo_type",
318291
"default_branch",
292+
"language",
293+
"description",
294+
# Project related settings
295+
"default_version",
319296
"privacy_level",
320-
"analytics_code",
321-
"analytics_disabled",
322-
"show_version_warning",
323297
"versioning_scheme",
324298
"external_builds_enabled",
325299
"external_builds_privacy_level",
326300
"readthedocs_yaml_path",
301+
"analytics_code",
302+
"analytics_disabled",
303+
"show_version_warning",
304+
# Meta data
305+
"programming_language",
306+
"project_url",
307+
"tags",
327308
)
328309

310+
description = forms.CharField(
311+
required=False,
312+
max_length=150,
313+
widget=forms.Textarea,
314+
)
315+
329316
def __init__(self, *args, **kwargs):
330317
super().__init__(*args, **kwargs)
331-
332318
# Remove the nullable option from the form
333319
self.fields["analytics_disabled"].widget = forms.CheckboxInput()
334320
self.fields["analytics_disabled"].empty_value = False
@@ -491,30 +477,6 @@ def get_all_active_versions(self):
491477
return all_versions
492478
return None
493479

494-
495-
class UpdateProjectForm(
496-
ProjectTriggerBuildMixin,
497-
ProjectBasicsForm,
498-
ProjectExtraForm,
499-
):
500-
501-
"""Basic project settings form for Admin."""
502-
503-
class Meta: # noqa
504-
model = Project
505-
fields = (
506-
# Basics
507-
"name",
508-
"repo",
509-
"repo_type",
510-
# Extra
511-
"description",
512-
"language",
513-
"programming_language",
514-
"project_url",
515-
"tags",
516-
)
517-
518480
def clean_language(self):
519481
"""Ensure that language isn't already active."""
520482
language = self.cleaned_data["language"]
@@ -544,6 +506,17 @@ def clean_language(self):
544506
)
545507
return language
546508

509+
def clean_tags(self):
510+
tags = self.cleaned_data.get("tags", [])
511+
for tag in tags:
512+
if len(tag) > 100:
513+
raise forms.ValidationError(
514+
_(
515+
"Length of each tag must be less than or equal to 100 characters.",
516+
),
517+
)
518+
return tags
519+
547520

548521
class ProjectRelationshipForm(forms.ModelForm):
549522

0 commit comments

Comments
 (0)