Skip to content

Commit

Permalink
style(ors-menu): adjust code identation
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Aug 31, 2021
1 parent 935e101 commit 15735c3
Showing 1 changed file with 85 additions and 85 deletions.
170 changes: 85 additions & 85 deletions src/support/ors-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,91 +33,91 @@ const loginMenuItem = {
* @param {*} menu
*/
const runORSMenuCustomization = (menu) => {
for (const key in menu) {
menu[key] = menuManager.addBaseExternalUrl(menu[key])
menu[key].target = '_blank'
}

menu.push({
href: appConfig.appMenu.baseMenuExternalUrl + '/dev/#/logout',
title: 'Logout',
target: '_blank',
icon: 'power_settings_new',
requiresBeAuthenticated: true,
showIcon: true
})
menuManager.injectAt(menu, 0, {
header: 'Links'
})
menuManager.injectAt(menu, 0, {
href: appConfig.appMenu.baseMenuExternalUrl,
title: 'Home',
target: '_blank',
icon: 'home',
notInHeader: true,
external: true
})

// replace the signup item for a custom one that requires a non authenticated user to be displayed
menuManager.replaceItemEndingWith(menu, '/signup', loginMenuItem.items[0])

// we can control if the custom icons are applied in the app config
if (appConfig.appMenu.setCustomMenuIcons === true) {
setORSMenuIcons(menu)
}
for (const key in menu) {
menu[key] = menuManager.addBaseExternalUrl(menu[key])
menu[key].target = '_blank'
}

/**
* Set the default icons based in the menu item's url endpoint
*
* @param {*} items
*/
const setORSMenuIcons = (items) => {
items.forEach(item => {
if (!item.href) {
return
}

const href = item.href.endsWith('/') ? item.href.substr(0, (item.href.length - 1)) : item.href
const hrefEnding = href.substr(href.lastIndexOf('/'))

switch (hrefEnding) {
case '/':
item.icon = 'home'
break
case '/services':
item.icon = 'domain'
break
case '/directions':
item.icon = 'directions'
break
case '/geocoding':
item.icon = 'location_searching'
break
case '/locations':
item.icon = 'location_on'
break
case '/isochrones':
item.icon = 'graphic_eq'
break
case '/news':
item.icon = 'library_books'
break
case '/maps':
item.icon = 'map'
break
case '/plans':
item.icon = 'payment'
break
case '/documentation':
item.icon = 'cloud'
break
}

if (item.items) {
setORSMenuIcons(item.items)
}
})

menu.push({
href: appConfig.appMenu.baseMenuExternalUrl + '/dev/#/logout',
title: 'Logout',
target: '_blank',
icon: 'power_settings_new',
requiresBeAuthenticated: true,
showIcon: true
})
menuManager.injectAt(menu, 0, {
header: 'Links'
})
menuManager.injectAt(menu, 0, {
href: appConfig.appMenu.baseMenuExternalUrl,
title: 'Home',
target: '_blank',
icon: 'home',
notInHeader: true,
external: true
})

// replace the signup item for a custom one that requires a non authenticated user to be displayed
menuManager.replaceItemEndingWith(menu, '/signup', loginMenuItem.items[0])

// we can control if the custom icons are applied in the app config
if (appConfig.appMenu.setCustomMenuIcons === true) {
setORSMenuIcons(menu)
}
}

/**
* Set the default icons based in the menu item's url endpoint
*
* @param {*} items
*/
const setORSMenuIcons = (items) => {
items.forEach(item => {
if (!item.href) {
return
}

const href = item.href.endsWith('/') ? item.href.substr(0, (item.href.length - 1)) : item.href
const hrefEnding = href.substr(href.lastIndexOf('/'))

switch (hrefEnding) {
case '/':
item.icon = 'home'
break
case '/services':
item.icon = 'domain'
break
case '/directions':
item.icon = 'directions'
break
case '/geocoding':
item.icon = 'location_searching'
break
case '/locations':
item.icon = 'location_on'
break
case '/isochrones':
item.icon = 'graphic_eq'
break
case '/news':
item.icon = 'library_books'
break
case '/maps':
item.icon = 'map'
break
case '/plans':
item.icon = 'payment'
break
case '/documentation':
item.icon = 'cloud'
break
}

if (item.items) {
setORSMenuIcons(item.items)
}
})
}

export default { runORSMenuCustomization }
export default { runORSMenuCustomization }

0 comments on commit 15735c3

Please sign in to comment.