-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Addons: update form to show all the options #11031
Conversation
Add all the configuration options to the `AddonsConfigForm` so the user is able to enable/disable each of the addons independently. Closes readthedocs/ext-theme#211
readthedocs/projects/forms.py
Outdated
if field.startswith("stable_latest_version_warning_") | ||
], | ||
), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted at readthedocs/ext-theme#262 (comment)
Two things that are important here:
First, I think this interface will eventually use a tabbed interface, not fieldsets, or might even use separate form/views entirely -- we'll know more once we start adding deeper configuration options here. But for that, I am gathering fieldsets will probably be removed in the future.
Second, I wanted to discuss avoiding (and probably removing) use of Crispy layouts and the layout API. Having HTML authoring removed from template code is a bit awkward already, just given the code/template separation and repository split, but it gets much worse if we want JS/Knockout/etc code in the form.
For that, I might suggest keeping this incredibly simple for a first pass and removing fieldsets and Python HTML authoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that, I might suggest keeping this incredibly simple for a first pass and removing fieldsets and Python HTML authoring.
How do you imagine that version? Just a bunch of inline checkboxes, as shown in readthedocs/ext-theme#262 (comment))?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems like plenty 👍
It will look minimal, but should be fine -- especially with a fix for block display checkboxes. We definitely will want to improve on that later in some way in the future, and we can start mocking out what that looks like once we know what other configuration fields we want there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will move forward with the required changes on this PR and we can tackle that CSS issue in ext-theme, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that sounds good. I agree it's probably minor and I should be able to squeeze a fix into the crispy field template before deploy
Create an `AddonsConfig` object when going to the form view to edit its preferences. By default, disable all the addons for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! There are a few display issues I'll follow up on tomorrow or monday.
@@ -529,17 +529,27 @@ class AddonsConfigForm(forms.ModelForm): | |||
|
|||
class Meta: | |||
model = AddonsConfig | |||
fields = ("enabled", "project") | |||
fields = ( | |||
"enabled", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say the only thing I noticed is that this field renders as Enabled
, and should probably be more descriptive regardless of the pattern we use -- Enable Addons
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. I originally used the layout approach and added some text explaining this was "global". I'll check with the serializer if I can change how it renders since we are already using the help_text
to explain the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought we can use better labels for:
"external_version_warning_enabled": _("Show a notification on builds from Pull Requests"),
"stable_latest_version_warning_enabled": _("Show a notification on non-stable and latest versions"),
What do you think?
Also also, we can remove the enabled
part from all of them and just leave the name of the addon with the checkbox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought we can use better labels for
Yeah those look better! Just a small note that "Pull Request" should use proper noun capitalization, "pull request builds" can be used instead. I follow what GitHub uses: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
Also also, we can remove the enabled part
Aye, we could for this UI. Though thinking ahead to when we split it up to multiple pages/tabs, we might want the full verbose version "Flyout enabled"? I suppose I'd leave the "enabled" part on the text for now and if we want to remove it later we can. For now, the extra enabled
isn't making the options any less clear.
Add all the configuration options to the
AddonsConfigForm
so the user is able to enable/disable each of the addons independently.This is the initial version of this work. We will keep adding more configuration options to each of the addons. That's why I decided to create one section per each. In the future, instead of just a regular
FieldSet
we can get more fancy and use tabs instead (creating a custom class or giving it a try to https://crispy-forms-gds.readthedocs.io/en/latest/components/tabs.html)Preview
ToDo
Feature
flags to disable specific addonsCloses readthedocs/ext-theme#211