Skip to content
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

Fix separator for menu item without children #16647

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _build/templates/default/sass/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
display: none;
}
#user-username {
white-space: nowrap;
white-space: nowrap;
overflow: hidden;
max-width: 7ch;
text-overflow: ellipsis;
Expand All @@ -108,7 +108,7 @@
margin: 0;
padding: 0;

.top:not(#modx-manager-search-icon) {
> li {
border-top: 1px solid $navbarBorder;
}

Expand Down
76 changes: 39 additions & 37 deletions manager/assets/modext/core/modx.layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,48 +455,50 @@ Ext.extend(MODx.Layout, Ext.Viewport, {
var position = window.innerWidth <= 960 ? 'bottom' : 'right';
for (var i = 0; i < buttons.length; i++) {
var submenu = document.getElementById(buttons[i].id + '-submenu');
new Popper(buttons[i], submenu, {
placement: position,
modifiers: {
arrow: {
element: submenu.getElementsByClassName('modx-subnav-arrow')[0]
},
flip: {
enabled: false
},
applyStyle: {
enabled: true,
fn: function(data) {
for (var i in data.offsets.popper) {
if (i !== 'bottom' && i !== 'right') {
if (data.offsets.popper.hasOwnProperty(i)) {
data.instance.popper.style[i] = !isNaN(parseFloat(data.offsets.popper[i]))
? data.offsets.popper[i] + 'px'
: data.offsets.popper[i];
if (submenu) {
new Popper(buttons[i], submenu, {
placement: position,
modifiers: {
arrow: {
element: submenu.getElementsByClassName('modx-subnav-arrow')[0]
},
flip: {
enabled: false
},
applyStyle: {
enabled: true,
fn: function (data) {
for (var i in data.offsets.popper) {
if (i !== 'bottom' && i !== 'right') {
if (data.offsets.popper.hasOwnProperty(i)) {
data.instance.popper.style[i] = !isNaN(parseFloat(data.offsets.popper[i]))
? data.offsets.popper[i] + 'px'
: data.offsets.popper[i];
}
}
if (data.offsets.arrow.top !== '') {
data.arrowElement.style.top = data.offsets.arrow.top + 'px';
}
if (data.offsets.arrow.left) {
data.arrowElement.style.left = data.offsets.arrow.left + 'px';
}
}
if (data.offsets.arrow.top !== '') {
data.arrowElement.style.top = data.offsets.arrow.top + 'px';
}
if (data.offsets.arrow.left) {
data.arrowElement.style.left = data.offsets.arrow.left + 'px';
}
}
},
preventOverflow: {
boundariesElement: document.getElementById('modx-container'),
priority: position === 'right'
? ['bottom', 'top']
: ['left', 'right']
}
},
preventOverflow: {
boundariesElement: document.getElementById('modx-container'),
priority: position === 'right'
? ['bottom','top']
: ['left','right']
}
}
});
buttons[i].addEventListener('click', function(e) {
e.stopPropagation();
el.focusRestoreEls.push(this.querySelectorAll('a')[0]);
el.showMenu(this);
});
});
buttons[i].addEventListener('click', function (e) {
e.stopPropagation();
el.focusRestoreEls.push(this.querySelectorAll('a')[0]);
el.showMenu(this);
});
}
}
window.addEventListener('click', function() {
el.hideMenu();
Expand Down
2 changes: 1 addition & 1 deletion manager/assets/modext/modx.jsgrps-min.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions manager/controllers/default/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,16 @@
$description = '<span class="description">'.$menu['description'].'</span>'."\n";
}

$top = !empty($menu['children']) ? ' top' : '';
$position = $idx <= 2 && $placeholder == 'navb' ? 'down' : 'up';

$menuTpl = '<li id="limenu-'.$menu['id'].'"class="menu-'.$position.$top.'">'."\n";
$menuTpl = '<li id="limenu-'.$menu['id'].'"class="menu-'.$position.' top">'."\n";

Check failure on line 184 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space before "."; 0 found

Check failure on line 184 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space after "."; 0 found

Check failure on line 184 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space before "."; 0 found

Check failure on line 184 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space after "."; 0 found

Check failure on line 184 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space before "."; 0 found
if (!empty($menu['action'])) {
if ($menu['namespace'] != 'core') {
// Handle the namespace
$menu['action'] .= '&namespace='.$menu['namespace'];
}
$onclick = (!empty($menu['handler'])) ? ' onclick="'.str_replace('"','\'',$menu['handler']).'"' : '';
$menuTpl .= '<a href="?a='.$menu['action'].$menu['params'].'"'.( $top ? ' class="top-link"': '' ).$onclick.$title.$ariaLabel.'>'.$label.$description.'</a>'."\n";
$menuTpl .= '<a href="?a=' . $menu['action'] . $menu['params'] . '"' . $onclick . $title . $ariaLabel . '>' . $label . $description . '</a>' . "\n";

Check warning on line 191 in manager/controllers/default/header.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 164 characters
} elseif (!empty($menu['handler'])) {
$menuTpl .= '<a href="javascript:;" onclick="'.str_replace('"','\'',$menu['handler']).'"'.$title.$ariaLabel.'>'.$label.$description.'</a>'."\n";
} else {
Expand Down
2 changes: 1 addition & 1 deletion manager/templates/default/css/index-min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manager/templates/default/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -23320,7 +23320,7 @@ ul.x-tab-strip-bottom .x-tab-left {
margin: 0;
padding: 0;
}
#modx-navbar #modx-topnav .top:not(#modx-manager-search-icon) {
#modx-navbar #modx-topnav > li {
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
#modx-navbar #modx-topnav > li:not(#modx-home-dashboard):not(#modx-manager-search-icon):not(#modx-leftbar-trigger) > a {
Expand Down
Loading