Skip to content

fix: Remove text decorations in page tree introduced by django 5.2 #8214

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 5 commits into from
May 6, 2025

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Apr 26, 2025

Description

Django 5.2 introduces a text-decoration underline for all link tags (<a>). This PR removes the text-decoration for the page tree.

Related resources

image

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:

  • Remove unwanted text decoration (underline) from links within the page tree introduced by Django 5.2.

Summary by Sourcery

Bug Fixes:

  • Removed text decoration from page tree and button links in the admin interface

Copy link
Contributor

sourcery-ai bot commented Apr 26, 2025

Reviewer's Guide

This pull request overrides the default link text decoration introduced in Django 5.2 by adding specific CSS rules with higher specificity in the admin SCSS files.

Flow Diagram: CSS Override for Page Tree Link Decoration

graph TD
    subgraph ProblemContext["Problem: Unwanted Underlines from Django 5.2"]
        DjangoGlobalStyle["Django 5.2 Global Style (`a { text-decoration: underline; }`)"]
        PageTreeLinks["Page Tree Links (`<a>` elements)"]
        DjangoGlobalStyle -- "Applies to all `<a>` tags" --> PageTreeLinks
        PageTreeLinks -- "Results in" --> UnwantedEffect["Unwanted Underline on Page Tree Links"]
    end

    subgraph PR_Fix["PR Fix: Specific CSS Override"]
        PR_SpecificStyle["PR's Added CSS Rules (e.g., `#content-main .cms-pagetree a { text-decoration: none; }`)"]
        PR_SpecificStyle -- "Specifically target" --> PageTreeLinks
        PR_SpecificStyle -- "Have higher CSS specificity than" --> DjangoGlobalStyle
        PageTreeLinks -- "Render with (due to override)" --> DesiredEffect["No Underline on Page Tree Links (Corrected Appearance)"]
    end

    UnwantedEffect -. "Corrected to" .-> DesiredEffect
Loading

File-Level Changes

Change Details Files
Override Django 5.2 default link underline for page tree elements.
  • Added CSS rule #content-main .cms-pagetree.cms-pagetree a { text-decoration: none; } to remove underline from page tree links.
  • Added CSS rule #content-main a.btn.btn, #content-main a.cms-btn.cms-btn { text-decoration: none; } to remove underline from specific button links within the main content area.
  • Used higher specificity selectors to ensure overrides apply correctly over Django's default styles.
cms/static/cms/sass/cms.admin.scss
cms/static/cms/sass/components/pagetree/_tree.scss

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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fsbraun - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider simplifying the CSS selector; repeating .cms-pagetree might be unnecessary to achieve the desired specificity.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@fsbraun fsbraun marked this pull request as draft April 28, 2025 12:26
@fsbraun fsbraun added the needs to be backported Commits need to be backported label May 6, 2025
@fsbraun fsbraun added the 5.0 label May 6, 2025
@fsbraun fsbraun marked this pull request as ready for review May 6, 2025 07:52
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fsbraun - I've reviewed your changes - here's some feedback:

  • Consider if the repeated class .cms-pagetree.cms-pagetree is necessary for the selector's specificity.
  • Consider if the repeated class .btn.btn is necessary for the selector's specificity.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vinitkumar vinitkumar merged commit 8f9ed64 into develop-4 May 6, 2025
65 checks passed
fsbraun added a commit that referenced this pull request May 6, 2025
…8214)

* fix: Remove text decorations in page tree introduced by django 5.2

* Update cms/static/cms/sass/components/pagetree/_tree.scss

* Fix: Update action buttons
@fsbraun fsbraun deleted the fix/remove-django52-admin-decorations branch May 6, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 needs to be backported Commits need to be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants