Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder and cleanup project settings page #11470

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/user/guides/setup/versioning-schemes.rst
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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`.
2 changes: 1 addition & 1 deletion docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/user/versioning-schemes.rst
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
26 changes: 16 additions & 10 deletions readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,30 +407,31 @@ 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_privacy_level",
"external_builds_enabled",
# Deprecated
"analytics_code",
"analytics_disabled",
"show_version_warning",
)

# Make description smaller, only a CharField
description = forms.CharField(
required=False,
max_length=150,
widget=forms.Textarea,
help_text=_("Short description of this project"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still want the textarea widget here, otherwise the input will be pretty small. The length is fixed at 150 anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My goal here is to make the description much less prominent -- when it's a textarea, it's like 5x larger than all the other fields, and it's one of the least important. I think making it a normal input makes it more obvious that it also should be short :)

)

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -466,6 +467,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)
Expand Down
88 changes: 88 additions & 0 deletions readthedocs/projects/migrations/0125_update_naming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Generated by Django 4.2.13 on 2024-07-15 22:05

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="historicalproject",
name="versioning_scheme",
field=models.CharField(
choices=[
(
"multiple_versions_with_translations",
"Multiple versions with translations (/<language>/<version>/<filename>)",
),
(
"multiple_versions_without_translations",
"Multiple versions without translations (/<version>/<filename>)",
),
(
"single_version_without_translations",
"Single version without translations (/<filename>)",
),
],
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",
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="versioning_scheme",
field=models.CharField(
choices=[
(
"multiple_versions_with_translations",
"Multiple versions with translations (/<language>/<version>/<filename>)",
),
(
"multiple_versions_without_translations",
"Multiple versions without translations (/<version>/<filename>)",
),
(
"single_version_without_translations",
"Single version without translations (/<filename>)",
),
],
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",
),
),
]
11 changes: 6 additions & 5 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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.
Expand Down