Skip to content

Instantly share code, notes, and snippets.

@luggage66
Created December 6, 2016 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luggage66/5675a3911d26c66188253e5ac5b1b026 to your computer and use it in GitHub Desktop.
Save luggage66/5675a3911d26c66188253e5ac5b1b026 to your computer and use it in GitHub Desktop.
class App {
@computed
get sideBarItems() {
var items = [];
if (!this.user) return [];
items.push({ icon: 'fa-dollar', text: 'Paychex / Stratustime', goto: { url: 'https://paychex.centralservers.com/' }});
items.push({ icon: 'fa-home', text: 'Home', goto: { viewModel: 'homepage' }});
if (_.contains(this.user.permissions, 'permissions/coding')) {
items.push({ icon: 'fa-user', text: 'My Profile', goto: { viewModel: 'viewUser', args: {id: this.user.id, tab: 'details'} } });
items.push({ icon: 'fa-calendar-o', text: 'My Availability', goto: { viewModel: 'viewUserAvailability', args: {id: this.user.id } } });
items.push({ icon: 'fa-calendar', text: 'My Schedule', goto: { viewModel: 'viewUser', args: {id: this.user.id, tab: 'schedule'} } });
items.push({ icon: 'fa-clock-o', text: 'Production Sheets', goto: { viewModel: 'myProductionSheets' } });
items.push({ icon: 'fa-heartbeat', text: 'Charts/Worksheets', goto: { viewModel: 'searchAuditWorksheets'}});
items.push({ icon: 'fa-dollar', text: 'Pay Period Summaries', goto: { viewModel: 'productionSummaries', args: { query: { user: this.user.id } } }});
}
items.push({ icon: 'fa-book', text: 'Documents', goto: {viewModel: 'externalLinks' }})
return items;
}
mapMenuItems(items) {
let currentUrl = this.props.app.currentSidebarUrl;
return items.map((item, index) => {
if (item.dropdown) {
let { children, ...otherProps } = item;
//return React.createElement(SiteNavigationSubMenu, { key: index, menuActivated: this.openMainMenu, ...otherProps }, );
return <SiteNavigationSubMenu key={index} menuActivated={this.handleSubMenuExpanded} {...otherProps}>
{this.mapMenuItems(children)}
</SiteNavigationSubMenu>;
}
else {
let { goto, ...otherProps } = item;
let itemUrl = this.props.app.getUrl(goto);
//return React.createElement(SiteNavigationLink, { key: index, active: , goto, ...otherProps });
return <SiteNavigationLink key={index} active={itemUrl === currentUrl} goto={goto} {...otherProps} />;
}
});
}
render() {
<SiteNavigationMenu>{this.mapMenuItems(this.sideBarItems)}</SiteNavigationMenu>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment