feat: set a CMS menu link to open in new tab - via data#1151
Draft
wesleyboar wants to merge 6 commits into
Draft
feat: set a CMS menu link to open in new tab - via data#1151wesleyboar wants to merge 6 commits into
wesleyboar wants to merge 6 commits into
Conversation
Add PageMenuTarget page extension with a target CharField (choices: _blank, _self). A menu modifier stamps node.attr['target'] in one query; target_blank tag outputs it directly. CMS toolbar and Django admin expose the field per page. Made-with: Cursor
Add __str__ returning page title (replaces "PageMenuTarget object (N)"), set verbose_name, and document the hidden admin URLs in a comment. Made-with: Cursor
…pen-in-new-tab--via-db
Member
Author
|
Important I like this, but I have not merged yet, because I consider changing it's name and form to suggest we can add more (e.g. Update: Done. |
…pen-in-new-tab--via-db
This was referenced May 27, 2026
…ons submenu (#1163) ## Overview Renames `PageMenuTarget` to `PageNavOptions` and adds a "Page Options" flyout submenu in the CMS toolbar to house it — and future per-page options — without cluttering the Page menu. ## Related - [WP-1230](https://tacc-main.atlassian.net/browse/WP-1230) - merges into #1151 ## Changes - **renamed** `PageMenuTarget` → `PageNavOptions` (model, admin, toolbar, modifier) - **replaced** migration `0003_add_page_menu_target` → `0003_add_page_nav_options` - **added** "Page Options ▶" submenu in CMS toolbar Page menu - **moved** "Nav Options" modal item under that submenu ## Testing 1. `make start` 2. Navigate to any internal page in edit mode. 3. Open **Page** menu in CMS toolbar → **Page Options** → **Nav Options**. 4. Set **Target** to "Open in new window" and save. 5. Verify the nav link has `target="_blank"`. 6. Verify external redirect links still open in a new tab (existing behavior). ## UI https://github.com/user-attachments/assets/7cfdb6cb-eea2-488c-9a14-67b6d3ddec67 https://github.com/user-attachments/assets/80573b30-f714-4348-8fce-ab78f93635ee Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
Polished. Future additions would not further increase size of main menu. Might not use, because WP-1290 has simpler solution: add sub-domain to URL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Let CMS admin set a nav menu link's
targetattribute per page.Previously, only external links got
target="_blank"(via custom Core-CMS JavaScript).Related
Changes
PageNavOptionspage extension (model + migration)NewTabModifierfornode.attr['target']adds data for template to read
PageNavOptionsAdminandPageNavOptionsToolbarexposes field via CMS toolbar Page menu → Page Options → Nav Options
target_blanktagcms_menu.htmlTesting
make starttarget="_blank".UI
Toolbar.Option.mov
Admin.URL.mov
Old Solution (from 196496c)
how.you.could.change.whether.page.opens.in.new.window.mov
/admin/UINotes
The field lives in the CMS toolbar's Page menu under Page Options → Nav Options, not in Page settings. That is the only officially supported injection point for page extensions in Django CMS 3.11.
PageExtensionAdminhides the model from the Django admin index by design, so it is not discoverable by browsing. Direct URLs:/admin/taccsite_cms/pagenavoptions/add/?extended_object=<page_pk>/admin/taccsite_cms/pagenavoptions/<extension_pk>/change/The CMS toolbar item generates these URLs automatically.
Made with Cursor. Directed and scrutinized by @wesleyboar.