Skip to content

Commit

Permalink
Merge pull request #191 from SpeciesFileGroup/development
Browse files Browse the repository at this point in the history
Add label configuration
  • Loading branch information
jlpereira authored Nov 6, 2023
2 parents cd88724 + 15df3eb commit 73f822e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/modules/otus/composables/useChildrenRoutes.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { useRouter } from 'vue-router'
import { humanize, uncapitalize } from '@/utils/strings'
import { humanize } from '@/utils/strings'

export default function useChildrenRoutes() {
const router = useRouter()
const { children } = router
.getRoutes()
.find((route) => route.name === 'otus-id')

const makeLabel = (path, isUncapitalize) => {
const label = humanize(path)

return isUncapitalize ? uncapitalize(label) : label
}

return children.map(({ path, name, meta }) => ({
label: path && makeLabel(path, meta.uncapitalize),
label: path && (meta.label || humanize(path)),
path,
name,
meta
Expand Down
2 changes: 1 addition & 1 deletion src/modules/otus/constants/layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for (const key in tabsLayout) {
layouts[key] = {
panels: parsePanelConfiguraion(tabLayout?.panels || {}),
rankGroup: tabLayout.rank_group || [],
uncapitalize: tabLayout.uncapitalize
label: tabLayout.label
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/otus/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function makeChildrenRoutes() {
meta: {
tab,
rankGroup: layouts[tab].rankGroup,
uncapitalize: layouts[tab].uncapitalize
label: layouts[tab].label
}
}))
}
Expand Down

0 comments on commit 73f822e

Please sign in to comment.