Skip to content

fix: 7605 delete translations #8123

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jrief
Copy link
Contributor

@jrief jrief commented Jan 28, 2025

Description

Adds a second item to the context menu in the page tree. Now one can decide, if he wants to delete a page with all translations or just to delete the page in the current translation.

Screenshot 2025-01-28 at 15 55 09
  • I have opened this pull request against develop-4
  • 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

New Features:

  • Added a second item to the context menu in the page tree to allow users to choose between deleting a page with all translations or just the current translation.

Copy link
Contributor

sourcery-ai bot commented Jan 28, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new option in the page tree context menu to allow users to delete a page with all translations or just the current translation. It also includes changes to the styles and templates to support the new functionality.

Sequence diagram for page deletion process

sequenceDiagram
    actor User
    participant UI as Page Tree UI
    participant Backend as Django CMS Backend
    participant DB as Database

    User->>UI: Opens page context menu
    UI->>User: Shows delete options
    alt Delete all translations
        User->>UI: Clicks 'Delete all translations'
        UI->>Backend: Request delete page with all translations
        Backend->>DB: Delete page and all translations
        DB-->>Backend: Confirm deletion
        Backend-->>UI: Return success
        UI-->>User: Show success message
    else Delete current translation
        User->>UI: Clicks 'Delete this translation'
        UI->>Backend: Request delete current translation
        Backend->>DB: Delete current translation only
        DB-->>Backend: Confirm deletion
        Backend-->>UI: Return success
        UI-->>User: Show success message
    end
Loading

File-Level Changes

Change Details Files
Added a new 'delete all translations' option to the page tree context menu.
  • Added a new menu item to the actions dropdown in actions_dropdown.html.
  • Added logic to pageadmin.py to pass the current page content to the template.
  • Added a data attribute to the menu in menu.html to pass the current language.
cms/templates/admin/cms/page/tree/actions_dropdown.html
cms/admin/pageadmin.py
cms/templates/admin/cms/page/tree/menu.html
Updated the iconography to include a new 'dumpster' icon.
  • Added a new icon definition for 'dumpster' in _iconography.scss.
  • Added a new css class for the dumpster icon.
cms/static/cms/sass/components/_iconography.scss
Updated CSS files to include the new icon and adjust styles.
  • Added the new icon to the font definitions in cms.base.css.
  • Added the new icon to the font definitions in cms.admin.css.
  • Updated the styles in cms.pagetree.css to accommodate the new menu item.
  • Updated the styles in cms.welcome.css to accommodate the new icon.
  • Updated the styles in cms.wizard.css to accommodate the new icon.
cms/static/cms/css/4.1.1/cms.admin.css
cms/static/cms/css/4.1.1/cms.base.css
cms/static/cms/css/4.1.1/cms.pagetree.css
cms/static/cms/css/4.1.1/cms.welcome.css
cms/static/cms/css/4.1.1/cms.wizard.css

Possibly linked issues


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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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 @jrief - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please add tests to verify both deletion modes (single translation vs all translations) work correctly and don't accidentally delete unintended content
  • Consider adding a confirmation dialog when deleting all translations to prevent accidental deletion
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 changed the title Fix 7605 delete translations fix: 7605 delete translations Feb 18, 2025
@vinitkumar
Copy link
Member

@fsbraun Do you think this should make cut for 4.2/5?

Copy link

github-actions bot commented May 6, 2025

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added stale and removed stale labels May 6, 2025
@@ -277,9 +277,14 @@ def actions_menu(self, request, object_id, extra_context=None):
raise self._get_404_exception(object_id)

site = get_site(request)
preview_language = request.GET.get('language')
page_content = page.get_content_obj(request.GET.get('language'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
page_content = page.get_content_obj(request.GET.get('language'))
page_content = page.get_content_obj(preview_language)

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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy