-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Addons: make default root CSS selector a shared option #11767
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
Changes from all commits
44587ab
eac7122
9745c6c
9944508
f1a6c78
1ee65f6
bde7538
9bba9c2
14904c3
7cd3711
1d4360f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.16 on 2024-11-20 12:35 | ||
|
||
from django.db import migrations, models | ||
from django_safemigrate import Safe | ||
|
||
|
||
class Migration(migrations.Migration): | ||
safe = Safe.before_deploy | ||
|
||
dependencies = [ | ||
('projects', '0136_addons_customscript_notnull'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='addonsconfig', | ||
name='options_root_selector', | ||
field=models.CharField(blank=True, help_text='CSS selector for the main content of the page. Leave it blank for auto-detect.', max_length=128, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='historicaladdonsconfig', | ||
name='options_root_selector', | ||
field=models.CharField(blank=True, help_text='CSS selector for the main content of the page. Leave it blank for auto-detect.', max_length=128, null=True), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 4.2.16 on 2024-11-20 12:35 | ||
|
||
from django.db import migrations | ||
from django_safemigrate import Safe | ||
|
||
|
||
class Migration(migrations.Migration): | ||
safe = Safe.after_deploy | ||
|
||
dependencies = [ | ||
('projects', '0137_use_generic_root_selector'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='addonsconfig', | ||
name='doc_diff_root_selector', | ||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
), | ||
migrations.RemoveField( | ||
model_name='addonsconfig', | ||
name='linkpreviews_doctool_name', | ||
), | ||
migrations.RemoveField( | ||
model_name='addonsconfig', | ||
name='linkpreviews_doctool_version', | ||
), | ||
migrations.RemoveField( | ||
model_name='addonsconfig', | ||
name='linkpreviews_root_selector', | ||
), | ||
migrations.RemoveField( | ||
model_name='historicaladdonsconfig', | ||
name='doc_diff_root_selector', | ||
), | ||
migrations.RemoveField( | ||
model_name='historicaladdonsconfig', | ||
name='linkpreviews_doctool_name', | ||
), | ||
migrations.RemoveField( | ||
model_name='historicaladdonsconfig', | ||
name='linkpreviews_doctool_version', | ||
), | ||
migrations.RemoveField( | ||
model_name='historicaladdonsconfig', | ||
name='linkpreviews_root_selector', | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,13 +144,6 @@ class AddonsConfig(TimeStampedModel): | |
Everything is enabled by default. | ||
""" | ||
|
||
DOC_DIFF_DEFAULT_ROOT_SELECTOR = "[role=main]" | ||
LINKPREVIEWS_DEFAULT_ROOT_SELECTOR = "[role=main] a.internal" | ||
LINKPREVIEWS_DOCTOOL_NAME_CHOICES = ( | ||
("sphinx", "Sphinx"), | ||
("other", "Other"), | ||
) | ||
|
||
# Model history | ||
history = ExtraHistoricalRecords() | ||
|
||
|
@@ -167,6 +160,13 @@ class AddonsConfig(TimeStampedModel): | |
help_text="Enable/Disable all the addons on this project", | ||
) | ||
|
||
options_root_selector = models.CharField( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to work on this now, but I do remember that we mentioned that this will likely change across versions for a project (eg. someone changes Sphinx themes, or even doc tools across versions). I do wonder if a v2 of this feature adds something like this to a Version, which can be set via the I don't want to get into that rabbit role in this initial work, but I do think it's something we'll likely hit at some point. The order of precedence would then be:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think we will want to have addons configs per version at some point 👍🏼 -- I agree it's something to keep in mind and consider in the future. |
||
null=True, | ||
blank=True, | ||
max_length=128, | ||
help_text="CSS selector for the main content of the page. Leave it blank for auto-detect.", | ||
) | ||
|
||
# Whether or not load addons library when the requested page is embedded (e.g. inside an iframe) | ||
# https://github.com/readthedocs/addons/pull/415 | ||
options_load_when_embedded = models.BooleanField(default=False) | ||
|
@@ -181,12 +181,6 @@ class AddonsConfig(TimeStampedModel): | |
doc_diff_enabled = models.BooleanField(default=True) | ||
doc_diff_show_additions = models.BooleanField(default=True) | ||
doc_diff_show_deletions = models.BooleanField(default=True) | ||
doc_diff_root_selector = models.CharField( | ||
null=True, | ||
blank=True, | ||
max_length=128, | ||
help_text="CSS selector for the main content of the page", | ||
) | ||
|
||
# EthicalAds | ||
ethicalads_enabled = models.BooleanField(default=True) | ||
|
@@ -242,18 +236,6 @@ class AddonsConfig(TimeStampedModel): | |
|
||
# Link Previews | ||
linkpreviews_enabled = models.BooleanField(default=False) | ||
linkpreviews_root_selector = models.CharField(null=True, blank=True, max_length=128) | ||
linkpreviews_doctool_name = models.CharField( | ||
choices=LINKPREVIEWS_DOCTOOL_NAME_CHOICES, | ||
null=True, | ||
blank=True, | ||
max_length=128, | ||
) | ||
linkpreviews_doctool_version = models.CharField( | ||
null=True, | ||
blank=True, | ||
max_length=128, | ||
) | ||
|
||
|
||
class AddonSearchFilter(TimeStampedModel): | ||
|
Uh oh!
There was an error while loading. Please reload this page.