Skip to content

Move new menu item to sub menu#334

Open
krafit wants to merge 5 commits into
developfrom
develop-submenu
Open

Move new menu item to sub menu#334
krafit wants to merge 5 commits into
developfrom
develop-submenu

Conversation

@krafit

@krafit krafit commented Jun 13, 2026

Copy link
Copy Markdown
Member

I went for the path of least resistance and I'm not sure, this is my preferred solution.

The alternative route would be one merged page. And registering a single slug and switch views via a ?view= parameter inside show_view(). That would have been tidier, but it touches every internal page=... link in the three views and the #statify_dashboard selectors in dashboard.js.
I wanted to keep the edits light instead of doing a big restructuring of the codebase, but if we decide to go for the more complete approach, I'm game.

@krafit krafit added this to the 2.0.0 milestone Jun 13, 2026
@krafit krafit requested a review from stklcode June 13, 2026 08:41
@stklcode

stklcode commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

I like it. Though with same thoughs on the actual implementation.

Hidden menu pages are a pretty nice trick, but I think I'd prefer the "view" parameter here.

That would have been tidier, but it touches every internal page=... link in the three views [...]

Yes, but it's not that many links. Maybe bundle the generation to a helper method like dashboard_link( string $view ) if it gets too messy 🤔 But we have to take care about (hidden) form parameters, too.

[...] and the #statify_dashboard selectors in dashboard.js.

Really? We don't touch the DOM IDs within our views, so I guess there's no change required on this side.

#statify_dashboard is a selector for the dashboard widget anyway.

Sorry for taking over your branch, I've added a view=... refactoring als PoC, feel free to revert/drop the commit if we decide for another path.

@krafit

krafit commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

The more the merrier! The view approach would have been more or less the other way I contemplated, so no hard feelings at all.

Comment thread inc/class-statify-evaluation.php Outdated
Comment on lines 53 to 54
__( 'Statify', 'statify' ),
'Statify',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we translate the page title but hard-code the menu title? 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

whoops, that one slipped through.
Upon closer inspection we do the same thing in class-statify-dashboard.php 😅

Comment thread inc/class-statify-evaluation.php Outdated
<ul class="subsubsub">
<?php foreach ( $items as $key => $item ) : ?>
<li>
<a href="<?php echo esc_url( $item['url'] ); ?>"<?php echo empty( $item['current'] ) ? '' : ' class="current" aria-current="page"'; ?>><?php echo esc_html( $item['label'] ); ?></a><?php echo ( $key === $last_key ) ? '' : ' |'; ?>

@stklcode stklcode Jun 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would remove the separator from the markup and make it a design property, i.e. move it to CSS like this

Suggested change
<a href="<?php echo esc_url( $item['url'] ); ?>"<?php echo empty( $item['current'] ) ? '' : ' class="current" aria-current="page"'; ?>><?php echo esc_html( $item['label'] ); ?></a><?php echo ( $key === $last_key ) ? '' : ' |'; ?>
<a href="<?php echo esc_url( $item['url'] ); ?>"<?php echo empty( $item['current'] ) ? '' : ' class="current" aria-current="page"'; ?>><?php echo esc_html( $item['label'] ); ?></a>
.statify-subnav li:not(:last-child)::after {
    content: "|";
    margin-left: 0.25em;
}

@krafit krafit force-pushed the develop-submenu branch from 5d0ec46 to f0c48cc Compare June 16, 2026 21:28
@sonarqubecloud

Copy link
Copy Markdown

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