From 6e1965722931f9367f866a8344d731f761d63104 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Mon, 15 Jul 2024 13:44:21 -0700 Subject: [PATCH 1/5] Reorder and cleanup project settings page Fixes https://github.com/readthedocs/readthedocs.org/issues/9530 --- readthedocs/projects/forms.py | 24 ++++++++++++++---------- readthedocs/projects/models.py | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py index 9add9caab51..e46b61a0367 100644 --- a/readthedocs/projects/forms.py +++ b/readthedocs/projects/forms.py @@ -407,30 +407,29 @@ class Meta: # Basics and repo settings "name", "repo", - "repo_type", - "default_branch", "language", - "description", - # Project related settings "default_version", "privacy_level", "versioning_scheme", - "external_builds_enabled", - "external_builds_privacy_level", + "default_branch", "readthedocs_yaml_path", - "analytics_code", - "analytics_disabled", - "show_version_warning", # Meta data "programming_language", "project_url", + "description", "tags", + # Booleans + "external_builds_enabled", + "external_builds_privacy_level", + # Deprecated + "analytics_code", + "analytics_disabled", + "show_version_warning", ) description = forms.CharField( required=False, max_length=150, - widget=forms.Textarea, ) def __init__(self, *args, **kwargs): @@ -466,6 +465,11 @@ def __init__(self, *args, **kwargs): for field in ["privacy_level", "external_builds_privacy_level"]: self.fields.pop(field) + # Remove analytics from new dashboard + if settings.RTD_EXT_THEME_ENABLED: + for field in ["analytics_code", "analytics_disabled"]: + self.fields.pop(field) + default_choice = (None, "-" * 9) versions_choices = ( self.instance.versions(manager=INTERNAL) diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index 43508675823..4c09d40c861 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -257,7 +257,7 @@ class Project(models.Model): _("Repository URL"), max_length=255, validators=[validate_repository_url], - help_text=_("Hosted documentation repository URL"), + help_text=_("Git repository URL"), db_index=True, ) From 98c323d426319682b6bc85f2c51ad411298df1a0 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Mon, 15 Jul 2024 13:53:30 -0700 Subject: [PATCH 2/5] Add comment --- readthedocs/projects/forms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py index e46b61a0367..aa463cd30fe 100644 --- a/readthedocs/projects/forms.py +++ b/readthedocs/projects/forms.py @@ -427,9 +427,11 @@ class Meta: "show_version_warning", ) + # Make description smaller, only a CharField description = forms.CharField( required=False, max_length=150, + help_text=_("Short description of this project"), ) def __init__(self, *args, **kwargs): From 1b4b562f6dd61d5eaedc9884397d7697bd7c3854 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Mon, 15 Jul 2024 13:59:13 -0700 Subject: [PATCH 3/5] Add migration --- .../projects/migrations/0125_update_naming.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 readthedocs/projects/migrations/0125_update_naming.py diff --git a/readthedocs/projects/migrations/0125_update_naming.py b/readthedocs/projects/migrations/0125_update_naming.py new file mode 100644 index 00000000000..9660a9886fd --- /dev/null +++ b/readthedocs/projects/migrations/0125_update_naming.py @@ -0,0 +1,38 @@ +# Generated by Django 4.2.13 on 2024-07-15 20:58 + +from django.db import migrations, models +from django_safemigrate import Safe + +import readthedocs.projects.validators + + +class Migration(migrations.Migration): + safe = Safe.before_deploy + dependencies = [ + ("projects", "0124_remove_zh_locale"), + ] + + operations = [ + migrations.AlterField( + model_name="historicalproject", + name="repo", + field=models.CharField( + db_index=True, + help_text="Git repository URL", + max_length=255, + validators=[readthedocs.projects.validators.RepositoryURLValidator()], + verbose_name="Repository URL", + ), + ), + migrations.AlterField( + model_name="project", + name="repo", + field=models.CharField( + db_index=True, + help_text="Git repository URL", + max_length=255, + validators=[readthedocs.projects.validators.RepositoryURLValidator()], + verbose_name="Repository URL", + ), + ), + ] From 09db430dd58ebd2a413669f258f05e6299616bdc Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Mon, 15 Jul 2024 15:01:14 -0700 Subject: [PATCH 4/5] Make URL scheme more clear --- readthedocs/projects/forms.py | 2 +- readthedocs/projects/models.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py index aa463cd30fe..ce1071f4ce0 100644 --- a/readthedocs/projects/forms.py +++ b/readthedocs/projects/forms.py @@ -419,8 +419,8 @@ class Meta: "description", "tags", # Booleans - "external_builds_enabled", "external_builds_privacy_level", + "external_builds_enabled", # Deprecated "analytics_code", "analytics_disabled", diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index 4c09d40c861..c3750987310 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -280,16 +280,17 @@ class Project(models.Model): help_text=_("URL that documentation is expected to serve from"), ) versioning_scheme = models.CharField( - _("Versioning scheme"), + _("URL Versioning scheme"), max_length=120, default=constants.MULTIPLE_VERSIONS_WITH_TRANSLATIONS, choices=constants.VERSIONING_SCHEME_CHOICES, # TODO: remove after migration null=True, help_text=_( - "This affects how the URL of your documentation looks like, " - "and if it supports translations or multiple versions. " - "Changing the versioning scheme will break your current URLs." + "This affects URL your documentation is served from, " + "and if it supports translations or versions. " + "Changing the versioning scheme will break your current URLs, " + "so you might need to create a redirect." ), ) # TODO: this field is deprecated, use `versioning_scheme` instead. From a2ef707e40bdf0e7eda36a0fca41d6b6af4047a5 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Mon, 15 Jul 2024 15:06:30 -0700 Subject: [PATCH 5/5] Make versioning scheme a bit more obvious... --- docs/user/guides/setup/versioning-schemes.rst | 6 +-- docs/user/index.rst | 2 +- docs/user/versioning-schemes.rst | 2 +- .../projects/migrations/0125_update_naming.py | 52 ++++++++++++++++++- readthedocs/projects/models.py | 2 +- 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/docs/user/guides/setup/versioning-schemes.rst b/docs/user/guides/setup/versioning-schemes.rst index e19eb60c093..c4df4be25b5 100644 --- a/docs/user/guides/setup/versioning-schemes.rst +++ b/docs/user/guides/setup/versioning-schemes.rst @@ -1,5 +1,5 @@ -How to change the versioning scheme of your project -=================================================== +How to change the URL versioning scheme of your project +======================================================== In this guide, we show you how to change the versioning scheme of your project on Read the Docs. @@ -20,5 +20,5 @@ Changing the versioning scheme #. Go the :guilabel:`Admin` tab of your project. #. Click on :guilabel:`Settings`. -#. Select the new versioning scheme in the :guilabel:`Versioning scheme` dropdown. +#. Select the new versioning scheme in the :guilabel:`URL versioning scheme` dropdown. #. Click on :guilabel:`Save`. diff --git a/docs/user/index.rst b/docs/user/index.rst index 2ef18262d80..6ebdf66fe20 100644 --- a/docs/user/index.rst +++ b/docs/user/index.rst @@ -200,7 +200,7 @@ Learn more about our hosting features: Host your documentation in multiple languages. :doc:`/versioning-schemes` - Learn about different versioning schemes. + Learn about different URL versioning schemes. :doc:`/custom-domains` Host your documentation on your own domain. diff --git a/docs/user/versioning-schemes.rst b/docs/user/versioning-schemes.rst index 61a7fa7cb33..498b310fcaa 100644 --- a/docs/user/versioning-schemes.rst +++ b/docs/user/versioning-schemes.rst @@ -1,7 +1,7 @@ URL versioning schemes ====================== -The versioning scheme of your project defines the URL of your documentation, +The URL versioning scheme of your project defines the URL of your documentation, and if your project supports multiple versions or translations. Read the Docs supports three different versioning schemes: diff --git a/readthedocs/projects/migrations/0125_update_naming.py b/readthedocs/projects/migrations/0125_update_naming.py index 9660a9886fd..d4df48a81ca 100644 --- a/readthedocs/projects/migrations/0125_update_naming.py +++ b/readthedocs/projects/migrations/0125_update_naming.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.13 on 2024-07-15 20:58 +# Generated by Django 4.2.13 on 2024-07-15 22:05 from django.db import migrations, models from django_safemigrate import Safe @@ -24,6 +24,31 @@ class Migration(migrations.Migration): verbose_name="Repository URL", ), ), + migrations.AlterField( + model_name="historicalproject", + name="versioning_scheme", + field=models.CharField( + choices=[ + ( + "multiple_versions_with_translations", + "Multiple versions with translations (///)", + ), + ( + "multiple_versions_without_translations", + "Multiple versions without translations (//)", + ), + ( + "single_version_without_translations", + "Single version without translations (/)", + ), + ], + default="multiple_versions_with_translations", + help_text="This affects URL your documentation is served from, and if it supports translations or versions. Changing the versioning scheme will break your current URLs, so you might need to create a redirect.", + max_length=120, + null=True, + verbose_name="URL versioning scheme", + ), + ), migrations.AlterField( model_name="project", name="repo", @@ -35,4 +60,29 @@ class Migration(migrations.Migration): verbose_name="Repository URL", ), ), + migrations.AlterField( + model_name="project", + name="versioning_scheme", + field=models.CharField( + choices=[ + ( + "multiple_versions_with_translations", + "Multiple versions with translations (///)", + ), + ( + "multiple_versions_without_translations", + "Multiple versions without translations (//)", + ), + ( + "single_version_without_translations", + "Single version without translations (/)", + ), + ], + default="multiple_versions_with_translations", + help_text="This affects URL your documentation is served from, and if it supports translations or versions. Changing the versioning scheme will break your current URLs, so you might need to create a redirect.", + max_length=120, + null=True, + verbose_name="URL versioning scheme", + ), + ), ] diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index c3750987310..52feefd2d45 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -280,7 +280,7 @@ class Project(models.Model): help_text=_("URL that documentation is expected to serve from"), ) versioning_scheme = models.CharField( - _("URL Versioning scheme"), + _("URL versioning scheme"), max_length=120, default=constants.MULTIPLE_VERSIONS_WITH_TRANSLATIONS, choices=constants.VERSIONING_SCHEME_CHOICES,