8000 fix: Apphook widget detection by fsbraun · Pull Request #8263 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: Apphook widget detection #8263

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

Merged
merged 2 commits into from
Jun 24, 2025
Merged

fix: Apphook widget detection #8263

merged 2 commits into from
Jun 24, 2025

Conversation

fsbraun
Copy link
Member
@fsbraun fsbraun commented Jun 24, 2025

Description

In the process of removing inline javascript the detection of the apphook config selector broke.
This fix reads the apphook config from a script json file only after the dom has been loaded.

Related resources

Checklist

  • I have opened this pull request against main
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined the channel #pr-reviews on our Discord Server to find a “pr review buddy” who is going to review my pull request.

Summary by Sourcery

Bug Fixes:

  • Adjust the apphook config selector to query the script nested inside the div[data-cms-widget-applicationconfigselect] element.

Copy link
Contributor
sourcery-ai bot commented Jun 24, 2025

Reviewer's Guide

Adjusted apphook widget detection logic by changing the querySelector to target the script within a div marked by data-cms-widget-applicationconfigselect, restoring functionality after inline JavaScript removal.

Class diagram for apphook widget detection update

classDiagram
    class ApphookWidget {
        +Object apphookData
        +Object apphooks_configuration_url
        +String apphooks_configuration_value
        +void detectApphookConfig()
    }
    ApphookWidget : -querySelector('div[data-cms-widget-applicationconfigselect] script')
    ApphookWidget : +detectApphookConfig()
Loading

File-Level Changes

Change Details Files
Fix apphook widget detection selector to match updated HTML structure
  • Replaced querySelector argument to 'div[data-cms-widget-applicationconfigselect] script'
  • Removed old selector targeting script element directly
cms/static/cms/js/widgets/forms.apphookselect.js

Possibly linked issues

  • #12799: The PR changes the JavaScript selector to correctly find the apphook configuration data, fixing the empty dropdown issue.
  • #0: PR fixes the broken apphook selector detection causing the missing New draft button issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@django-cms django-cms deleted a comment from github-actions bot Jun 24, 2025
@django-cms django-cms deleted a comment from github-actions bot Jun 24, 2025
Copy link
Member
@vinitkumar vinitkumar left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@vinitkumar vinitkumar merged commit ec2f4e8 into release/5.0.x Jun 24, 2025
70 checks passed
fsbraun added a commit that referenced this pull request Jun 24, 2025
* fix: Apphook widget detection

* Fix: Add related
fsbraun added a commit that referenced this pull request Jun 24, 2025
* fix: Apphook widget detection

* Fix: Add related
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0