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] Show active admin and user account menu item #17047

Merged
merged 10 commits into from
Apr 21, 2020
2 changes: 1 addition & 1 deletion app/apps/client/admin/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const promptCloudLogin = () => {
html: false,
}, (confirmed) => {
if (confirmed) {
FlowRouter.go('cloud-config');
FlowRouter.go('cloud');
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion app/apps/client/admin/marketplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Template.marketplace.helpers({

Template.marketplace.events({
'click .js-cloud-login'() {
FlowRouter.go('cloud-config');
FlowRouter.go('cloud');
},
'submit .js-search-form'(event) {
event.stopPropagation();
Expand Down
4 changes: 2 additions & 2 deletions app/cloud/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { registerAdminRoute, registerAdminSidebarItem } from '../../ui-admin/cli
import { hasAtLeastOnePermission } from '../../authorization';

registerAdminRoute('/cloud', {
name: 'cloud-config',
name: 'cloud',
async action() {
await import('./admin');
BlazeLayout.render('main', { center: 'cloud', old: true });
Expand All @@ -25,7 +25,7 @@ registerAdminRoute('/cloud/oauth-callback', {

registerAdminSidebarItem({
icon: 'cloud-plus',
href: 'admin/cloud',
href: 'cloud',
i18nLabel: 'Connectivity_Services',
permissionGranted() {
return hasAtLeastOnePermission(['manage-cloud']);
Expand Down
2 changes: 1 addition & 1 deletion app/federation/client/admin/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ registerAdminRoute('/federation-dashboard', {

registerAdminSidebarItem({
icon: 'discover',
href: 'admin/federation-dashboard',
href: 'federation-dashboard',
i18nLabel: 'Federation Dashboard',
permissionGranted() {
return hasRole(Meteor.userId(), 'admin');
Expand Down
3 changes: 3 additions & 0 deletions app/livechat/client/views/sideNav/livechatFlex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Template } from 'meteor/templating';
import { FlowRouter } from 'meteor/kadira:flow-router';

import { SideNav, Layout } from '../../../../ui-utils';
import { t } from '../../../../utils';
Expand All @@ -8,11 +9,13 @@ import { sidebarItems } from './livechatSideNavItems';

Template.livechatFlex.helpers({
menuItem(name, icon, section) {
const routeName = FlowRouter.getRouteName();
return {
name: t(name),
icon,
pathSection: section,
darken: true,
active: section === routeName,
};
},
embeddedVersion() {
Expand Down
4 changes: 4 additions & 0 deletions app/theme/client/imports/components/sidebar/sidebar-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
background-color: var(--sidebar-background-light-hover);
}

&--active {
background-color: var(--sidebar-background-light-active);
}

&__picture {
color: inherit;
}
Expand Down
1 change: 1 addition & 0 deletions app/theme/client/imports/general/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
--sidebar-background-hover: var(--rc-color-primary-dark);
--sidebar-background-light: var(--rc-color-primary-lightest);
--sidebar-background-light-hover: var(--rc-color-primary-light);
--sidebar-background-light-active: var(--rc-color-primary-light-medium);
--sidebar-default-padding: 24px;
--sidebar-small-default-padding: 16px;
--sidebar-extra-small-default-padding: 12px;
Expand Down
3 changes: 3 additions & 0 deletions app/ui-account/client/accountFlex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Template } from 'meteor/templating';
import { FlowRouter } from 'meteor/kadira:flow-router';

import { settings } from '../../settings';
import { hasAllPermission } from '../../authorization';
Expand Down Expand Up @@ -32,12 +33,14 @@ Template.accountFlex.helpers({
return settings.get('Webdav_Integration_Enabled');
},
menuItem(name, icon, section, group) {
const routeParam = FlowRouter.getParam('group');
return {
name: t(name),
icon,
pathSection: section,
pathGroup: group,
darken: true,
active: group === routeParam,
};
},
embeddedVersion() {
Expand Down
2 changes: 1 addition & 1 deletion app/ui-admin/client/adminFlex.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1 class="sidebar-flex__title">{{_ "Administration"}}</h1>
</header>
<div class="rooms-list {{#if embeddedVersion}}rooms-list--embedded{{/if}}" aria-label="{{_ "Administration"}}">
<ul class="rooms-list__list">
{{> sidebarItem menuItem "Info" "info-circled" "admin" "info" }}
{{> sidebarItem menuItem "Info" "info-circled" "admin-info" "" }}

{{#if hasPermission 'run-import'}}
{{> sidebarItem menuItem "Import" "import" "admin-import" "" }}
Expand Down
5 changes: 5 additions & 0 deletions app/ui-admin/client/adminFlex.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import s from 'underscore.string';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import { FlowRouter } from 'meteor/kadira:flow-router';

import { settings } from '../../settings';
import { menu, SideNav, Layout } from '../../ui-utils/client';
Expand Down Expand Up @@ -69,13 +70,17 @@ Template.adminFlex.helpers({
return getSidebarItems();
},
menuItem(name, icon, section, group) {
const routeParam = FlowRouter.getParam('group');
const routeName = FlowRouter.getRouteName();

return {
name: t(name),
icon,
pathSection: section,
pathGroup: group,
darken: true,
isLightSidebar: true,
active: (routeParam && routeParam === group) || (routeName !== 'admin' && routeName === section),
};
},
embeddedVersion() {
Expand Down
1 change: 1 addition & 0 deletions private/client/imports/general/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
--sidebar-background-hover: var(--rc-color-primary-dark);
--sidebar-background-light: var(--rc-color-primary-lightest);
--sidebar-background-light-hover: var(--rc-color-primary-light);
--sidebar-background-light-active: var(--rc-color-primary-light-medium);
--sidebar-default-padding: 24px;
--sidebar-small-default-padding: 16px;
--sidebar-extra-small-default-padding: 12px;
Expand Down