feat: add dashboard sub-pages to ACP menu

v1.18.x
Julian Lam 4 years ago
parent 655e2c67ad
commit 73dc64d9ff

@ -1,7 +1,6 @@
{ {
"dashboard": "Dashboard", "section-dashboard": "Dashboards",
"dashboard/overview": "Overview",
"section-dashboard": "Dashboard",
"dashboard/logins": "Logins", "dashboard/logins": "Logins",
"dashboard/users": "Users", "dashboard/users": "Users",
"dashboard/topics": "Topics", "dashboard/topics": "Topics",

@ -109,10 +109,7 @@
var mainTitle; var mainTitle;
var pageTitle; var pageTitle;
if (/admin\/general\/dashboard$/.test(url)) { if (/admin\/plugins\//.test(url)) {
pageTitle = '[[admin/menu:general/dashboard]]';
mainTitle = pageTitle;
} else if (/admin\/plugins\//.test(url)) {
mainTitle = fallback; mainTitle = fallback;
pageTitle = '[[admin/menu:section-plugins]] > ' + mainTitle; pageTitle = '[[admin/menu:section-plugins]] > ' + mainTitle;
} else { } else {
@ -126,8 +123,8 @@
mainTitle = translator.compile('admin/menu:settings.page-title', mainTitle); mainTitle = translator.compile('admin/menu:settings.page-title', mainTitle);
} }
} else { } else {
mainTitle = '[[admin/menu:dashboard]]'; mainTitle = '[[admin/menu:section-dashboard]]';
pageTitle = '[[admin/menu:dashboard]]'; pageTitle = '[[admin/menu:section-dashboard]]';
} }
} }

@ -101,15 +101,11 @@ async function buildNamespace(language, namespace) {
str = sanitize(str); str = sanitize(str);
let title = namespace; let title = namespace;
if (/admin\/general\/dashboard$/.test(title)) { title = title.match(/admin\/(.+?)\/(.+?)$/);
title = '[[admin/menu:dashboard]]'; title = `[[admin/menu:section-${
} else { title[1] === 'development' ? 'advanced' : title[1]
title = title.match(/admin\/(.+?)\/(.+?)$/); }]]${title[2] ? (` > [[admin/menu:${
title = `[[admin/menu:section-${ title[1]}/${title[2]}]]`) : ''}`;
title[1] === 'development' ? 'advanced' : title[1]
}]]${title[2] ? (` > [[admin/menu:${
title[1]}/${title[2]}]]`) : ''}`;
}
title = await translator.translate(title); title = await translator.translate(title);
return { return {

@ -177,8 +177,14 @@
<ul id="main-menu"> <ul id="main-menu">
{{{ if user.privileges.admin:dashboard }}} {{{ if user.privileges.admin:dashboard }}}
<li class="menu-item"> <li class="dropdown menu-item">
<a href="{relative_path}/admin/dashboard">[[admin/menu:dashboard]]</a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">[[admin/menu:section-dashboard]]</a>
<ul class="dropdown-menu" role="menu">
<li><a href="{relative_path}/admin/dashboard">[[admin/menu:dashboard/overview]]</a></li>
<li><a href="{relative_path}/admin/dashboard/logins">[[admin/menu:dashboard/logins]]</a></li>
<li><a href="{relative_path}/admin/dashboard/users">[[admin/menu:dashboard/users]]</a></li>
<li><a href="{relative_path}/admin/dashboard/topics">[[admin/menu:dashboard/topics]]</a></li>
</ul>
</li> </li>
{{{ end }}} {{{ end }}}

Loading…
Cancel
Save