View | Details | Raw Unified | Return to bug 33169
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js (-2 / +2 lines)
Lines 1-9 Link Here
1
export const $__ = (key) => {
1
export const $__ = key => {
2
    return window["__"](key);
2
    return window["__"](key);
3
};
3
};
4
4
5
export default {
5
export default {
6
    install: (app, options) => {
6
    install: (app, options) => {
7
        app.config.globalProperties.$__ = $__
7
        app.config.globalProperties.$__ = $__;
8
    },
8
    },
9
};
9
};
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/erm.ts (-1 / +1 lines)
Lines 60-66 app.mount("#erm"); Link Here
60
60
61
const { removeMessages } = mainStore;
61
const { removeMessages } = mainStore;
62
router.beforeEach((to, from) => {
62
router.beforeEach((to, from) => {
63
    navigationStore.$patch({current: to.matched, params: to.params||{}});
63
    navigationStore.$patch({ current: to.matched, params: to.params || {} });
64
    removeMessages(); // This will actually flag the messages as displayed already
64
    removeMessages(); // This will actually flag the messages as displayed already
65
});
65
});
66
router.afterEach((to, from) => {
66
router.afterEach((to, from) => {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js (-46 / +76 lines)
Lines 37-43 export const routes = [ Link Here
37
        path: "/cgi-bin/koha/erm/erm.pl",
37
        path: "/cgi-bin/koha/erm/erm.pl",
38
        is_default: true,
38
        is_default: true,
39
        is_base: true,
39
        is_base: true,
40
        title: $__('E-resource management'),
40
        title: $__("E-resource management"),
41
        children: [
41
        children: [
42
            {
42
            {
43
                path: "",
43
                path: "",
Lines 47-54 export const routes = [ Link Here
47
            },
47
            },
48
            {
48
            {
49
                path: "/cgi-bin/koha/erm/agreements",
49
                path: "/cgi-bin/koha/erm/agreements",
50
                title: $__('Agreements'),
50
                title: $__("Agreements"),
51
                icon: 'fa fa-check-circle',
51
                icon: "fa fa-check-circle",
52
                is_end_node: true,
52
                is_end_node: true,
53
                children: [
53
                children: [
54
                    {
54
                    {
Lines 60-84 export const routes = [ Link Here
60
                        path: ":agreement_id",
60
                        path: ":agreement_id",
61
                        name: "AgreementsShow",
61
                        name: "AgreementsShow",
62
                        component: markRaw(AgreementsShow),
62
                        component: markRaw(AgreementsShow),
63
                        title: $__('Show agreement'),
63
                        title: $__("Show agreement"),
64
                    },
64
                    },
65
                    {
65
                    {
66
                        path: "add",
66
                        path: "add",
67
                        name: "AgreementsFormAdd",
67
                        name: "AgreementsFormAdd",
68
                        component: markRaw(AgreementsFormAdd),
68
                        component: markRaw(AgreementsFormAdd),
69
                        title: $__('Add agreement'),
69
                        title: $__("Add agreement"),
70
                    },
70
                    },
71
                    {
71
                    {
72
                        path: "edit/:agreement_id",
72
                        path: "edit/:agreement_id",
73
                        name: "AgreementsFormAddEdit",
73
                        name: "AgreementsFormAddEdit",
74
                        component: markRaw(AgreementsFormAdd),
74
                        component: markRaw(AgreementsFormAdd),
75
                        title: $__('Edit agreement'),
75
                        title: $__("Edit agreement"),
76
                    },
76
                    },
77
                ],
77
                ],
78
            },
78
            },
79
            {
79
            {
80
                path: "/cgi-bin/koha/erm/licenses",
80
                path: "/cgi-bin/koha/erm/licenses",
81
                title: $__('Licenses'),
81
                title: $__("Licenses"),
82
                icon: "fa fa-gavel",
82
                icon: "fa fa-gavel",
83
                is_end_node: true,
83
                is_end_node: true,
84
                children: [
84
                children: [
Lines 91-195 export const routes = [ Link Here
91
                        path: ":license_id",
91
                        path: ":license_id",
92
                        name: "LicensesShow",
92
                        name: "LicensesShow",
93
                        component: markRaw(LicensesShow),
93
                        component: markRaw(LicensesShow),
94
                        title: $__('Show license'),
94
                        title: $__("Show license"),
95
                    },
95
                    },
96
                    {
96
                    {
97
                        path: "add",
97
                        path: "add",
98
                        name: "LicensesFormAdd",
98
                        name: "LicensesFormAdd",
99
                        component: markRaw(LicensesFormAdd),
99
                        component: markRaw(LicensesFormAdd),
100
                        title: $__('Add license'),
100
                        title: $__("Add license"),
101
                    },
101
                    },
102
                    {
102
                    {
103
                        path: "edit/:license_id",
103
                        path: "edit/:license_id",
104
                        name: "LicensesFormAddEdit",
104
                        name: "LicensesFormAddEdit",
105
                        component: markRaw(LicensesFormAdd),
105
                        component: markRaw(LicensesFormAdd),
106
                        title: $__('Edit license'),
106
                        title: $__("Edit license"),
107
                    },
107
                    },
108
                ],
108
                ],
109
            },
109
            },
110
            {
110
            {
111
                path: "/cgi-bin/koha/erm/eholdings",
111
                path: "/cgi-bin/koha/erm/eholdings",
112
                title: $__('eHoldings'),
112
                title: $__("eHoldings"),
113
                icon: 'fa fa-crosshairs',
113
                icon: "fa fa-crosshairs",
114
                disabled: true,
114
                disabled: true,
115
                children: [
115
                children: [
116
                    {
116
                    {
117
                        path: "local",
117
                        path: "local",
118
                        title: $__('Local'),
118
                        title: $__("Local"),
119
                        icon: "fa-solid fa-location-dot",
119
                        icon: "fa-solid fa-location-dot",
120
                        disabled: true,
120
                        disabled: true,
121
                        children: [
121
                        children: [
122
                            {
122
                            {
123
                                path: "packages",
123
                                path: "packages",
124
                                title: $__('Packages'),
124
                                title: $__("Packages"),
125
                                icon: "fa fa-archive",
125
                                icon: "fa fa-archive",
126
                                is_end_node: true,
126
                                is_end_node: true,
127
                                children: [
127
                                children: [
128
                                    {
128
                                    {
129
                                        path: "",
129
                                        path: "",
130
                                        name: "EHoldingsLocalPackagesList",
130
                                        name: "EHoldingsLocalPackagesList",
131
                                        component: markRaw(EHoldingsLocalPackagesList),
131
                                        component: markRaw(
132
                                            EHoldingsLocalPackagesList
133
                                        ),
132
                                    },
134
                                    },
133
                                    {
135
                                    {
134
                                        path: ":package_id",
136
                                        path: ":package_id",
135
                                        name: "EHoldingsLocalPackagesShow",
137
                                        name: "EHoldingsLocalPackagesShow",
136
                                        component: markRaw(EHoldingsLocalPackagesShow),
138
                                        component: markRaw(
137
                                        title: $__('Show package'),
139
                                            EHoldingsLocalPackagesShow
140
                                        ),
141
                                        title: $__("Show package"),
138
                                    },
142
                                    },
139
                                    {
143
                                    {
140
                                        path: "add",
144
                                        path: "add",
141
                                        name: "EHoldingsLocalPackagesFormAdd",
145
                                        name: "EHoldingsLocalPackagesFormAdd",
142
                                        component: markRaw(EHoldingsLocalPackagesFormAdd),
146
                                        component: markRaw(
143
                                        title: $__('Add package'),
147
                                            EHoldingsLocalPackagesFormAdd
148
                                        ),
149
                                        title: $__("Add package"),
144
                                    },
150
                                    },
145
                                    {
151
                                    {
146
                                        path: "edit/:package_id",
152
                                        path: "edit/:package_id",
147
                                        name: "EHoldingsLocalPackagesFormAddEdit",
153
                                        name: "EHoldingsLocalPackagesFormAddEdit",
148
                                        component: markRaw(EHoldingsLocalPackagesFormAdd),
154
                                        component: markRaw(
149
                                        title: $__('Edit package'),
155
                                            EHoldingsLocalPackagesFormAdd
156
                                        ),
157
                                        title: $__("Edit package"),
150
                                    },
158
                                    },
151
                                ],
159
                                ],
152
                            },
160
                            },
153
                            {
161
                            {
154
                                path: "titles",
162
                                path: "titles",
155
                                title: $__('Titles'),
163
                                title: $__("Titles"),
156
                                icon: "fa-solid fa-arrow-down-a-z",
164
                                icon: "fa-solid fa-arrow-down-a-z",
157
                                is_end_node: true,
165
                                is_end_node: true,
158
                                children: [
166
                                children: [
159
                                    {
167
                                    {
160
                                        path: "",
168
                                        path: "",
161
                                        name: "EHoldingsLocalTitlesList",
169
                                        name: "EHoldingsLocalTitlesList",
162
                                        component: markRaw(EHoldingsLocalTitlesList),
170
                                        component: markRaw(
171
                                            EHoldingsLocalTitlesList
172
                                        ),
163
                                    },
173
                                    },
164
                                    {
174
                                    {
165
                                        path: ":title_id",
175
                                        path: ":title_id",
166
                                        name: "EHoldingsLocalTitlesShow",
176
                                        name: "EHoldingsLocalTitlesShow",
167
                                        component: markRaw(EHoldingsLocalTitlesShow),
177
                                        component: markRaw(
168
                                        title: $__('Show title'),
178
                                            EHoldingsLocalTitlesShow
179
                                        ),
180
                                        title: $__("Show title"),
169
                                    },
181
                                    },
170
                                    {
182
                                    {
171
                                        path: "add",
183
                                        path: "add",
172
                                        name: "EHoldingsLocalTitlesFormAdd",
184
                                        name: "EHoldingsLocalTitlesFormAdd",
173
                                        component: markRaw(EHoldingsLocalTitlesFormAdd),
185
                                        component: markRaw(
174
                                        title: $__('Add title'),
186
                                            EHoldingsLocalTitlesFormAdd
187
                                        ),
188
                                        title: $__("Add title"),
175
                                    },
189
                                    },
176
                                    {
190
                                    {
177
                                        path: "edit/:title_id",
191
                                        path: "edit/:title_id",
178
                                        name: "EHoldingsLocalTitlesFormAddEdit",
192
                                        name: "EHoldingsLocalTitlesFormAddEdit",
179
                                        component: markRaw(EHoldingsLocalTitlesFormAdd),
193
                                        component: markRaw(
180
                                        title: $__('Edit title'),
194
                                            EHoldingsLocalTitlesFormAdd
195
                                        ),
196
                                        title: $__("Edit title"),
181
                                    },
197
                                    },
182
                                    {
198
                                    {
183
                                        path: "import",
199
                                        path: "import",
184
                                        name: "EHoldingsLocalTitlesFormImport",
200
                                        name: "EHoldingsLocalTitlesFormImport",
185
                                        component: markRaw(EHoldingsLocalTitlesFormImport),
201
                                        component: markRaw(
186
                                        title: $__('Import from a list'),
202
                                            EHoldingsLocalTitlesFormImport
203
                                        ),
204
                                        title: $__("Import from a list"),
187
                                    },
205
                                    },
188
                                    {
206
                                    {
189
                                        path: "/cgi-bin/koha/erm/eholdings/local/resources/:resource_id",
207
                                        path: "/cgi-bin/koha/erm/eholdings/local/resources/:resource_id",
190
                                        name: "EHoldingsLocalResourcesShow",
208
                                        name: "EHoldingsLocalResourcesShow",
191
                                        component: markRaw(EHoldingsLocalResourcesShow),
209
                                        component: markRaw(
192
                                        title: $__('Resource'),
210
                                            EHoldingsLocalResourcesShow
211
                                        ),
212
                                        title: $__("Resource"),
193
                                    },
213
                                    },
194
                                ],
214
                                ],
195
                            },
215
                            },
Lines 197-247 export const routes = [ Link Here
197
                    },
217
                    },
198
                    {
218
                    {
199
                        path: "ebsco",
219
                        path: "ebsco",
200
                        title: $__('EBSCO'),
220
                        title: $__("EBSCO"),
201
                        icon: 'fa fa-globe',
221
                        icon: "fa fa-globe",
202
                        disabled: true,
222
                        disabled: true,
203
                        children: [
223
                        children: [
204
                            {
224
                            {
205
                                path: "packages",
225
                                path: "packages",
206
                                title: $__('Packages'),
226
                                title: $__("Packages"),
207
                                icon: "fa fa-archive",
227
                                icon: "fa fa-archive",
208
                                is_end_node: true,
228
                                is_end_node: true,
209
                                children: [
229
                                children: [
210
                                    {
230
                                    {
211
                                        path: "",
231
                                        path: "",
212
                                        name: "EHoldingsEBSCOPackagesList",
232
                                        name: "EHoldingsEBSCOPackagesList",
213
                                        component: markRaw(EHoldingsEBSCOPackagesList),
233
                                        component: markRaw(
234
                                            EHoldingsEBSCOPackagesList
235
                                        ),
214
                                    },
236
                                    },
215
                                    {
237
                                    {
216
                                        path: ":package_id",
238
                                        path: ":package_id",
217
                                        name: "EHoldingsEBSCOPackagesShow",
239
                                        name: "EHoldingsEBSCOPackagesShow",
218
                                        component: markRaw(EHoldingsEBSCOPackagesShow),
240
                                        component: markRaw(
219
                                        title: $__('Show package'),
241
                                            EHoldingsEBSCOPackagesShow
242
                                        ),
243
                                        title: $__("Show package"),
220
                                    },
244
                                    },
221
                                ],
245
                                ],
222
                            },
246
                            },
223
                            {
247
                            {
224
                                path: "titles",
248
                                path: "titles",
225
                                title: $__('Titles'),
249
                                title: $__("Titles"),
226
                                icon: "fa-solid fa-arrow-down-a-z",
250
                                icon: "fa-solid fa-arrow-down-a-z",
227
                                is_end_node: true,
251
                                is_end_node: true,
228
                                children: [
252
                                children: [
229
                                    {
253
                                    {
230
                                        path: "",
254
                                        path: "",
231
                                        name: "EHoldingsEBSCOTitlesList",
255
                                        name: "EHoldingsEBSCOTitlesList",
232
                                        component: markRaw(EHoldingsEBSCOTitlesList),
256
                                        component: markRaw(
257
                                            EHoldingsEBSCOTitlesList
258
                                        ),
233
                                    },
259
                                    },
234
                                    {
260
                                    {
235
                                        path: ":title_id",
261
                                        path: ":title_id",
236
                                        name: "EHoldingsEBSCOTitlesShow",
262
                                        name: "EHoldingsEBSCOTitlesShow",
237
                                        component: markRaw(EHoldingsEBSCOTitlesShow),
263
                                        component: markRaw(
238
                                        title: $__('Show title'),
264
                                            EHoldingsEBSCOTitlesShow
265
                                        ),
266
                                        title: $__("Show title"),
239
                                    },
267
                                    },
240
                                    {
268
                                    {
241
                                        path: "/cgi-bin/koha/erm/eholdings/ebsco/resources/:resource_id",
269
                                        path: "/cgi-bin/koha/erm/eholdings/ebsco/resources/:resource_id",
242
                                        name: "EHoldingsEBSCOResourcesShow",
270
                                        name: "EHoldingsEBSCOResourcesShow",
243
                                        component: markRaw(EHoldingsEBSCOResourcesShow),
271
                                        component: markRaw(
244
                                        title: $__('Resource'),
272
                                            EHoldingsEBSCOResourcesShow
273
                                        ),
274
                                        title: $__("Resource"),
245
                                        is_navigation_item: false,
275
                                        is_navigation_item: false,
246
                                    },
276
                                    },
247
                                ],
277
                                ],
Lines 250-255 export const routes = [ Link Here
250
                    },
280
                    },
251
                ],
281
                ],
252
            },
282
            },
253
        ]
283
        ],
254
    },
284
    },
255
];
285
];
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js (-58 / +66 lines)
Lines 1-6 Link Here
1
import {
1
import { defineStore } from "pinia";
2
    defineStore
3
} from "pinia";
4
2
5
export const useNavigationStore = defineStore("navigation", {
3
export const useNavigationStore = defineStore("navigation", {
6
    state: () => ({
4
    state: () => ({
Lines 9-15 export const useNavigationStore = defineStore("navigation", { Link Here
9
            href: "/cgi-bin/koha/mainpage.pl",
7
            href: "/cgi-bin/koha/mainpage.pl",
10
            is_navigation_item: false,
8
            is_navigation_item: false,
11
            is_base: true,
9
            is_base: true,
12
            children: []
10
            children: [],
13
        },
11
        },
14
        current: null,
12
        current: null,
15
        params: {},
13
        params: {},
Lines 17-28 export const useNavigationStore = defineStore("navigation", { Link Here
17
    actions: {
15
    actions: {
18
        setRoutes(routesDef) {
16
        setRoutes(routesDef) {
19
            if (!Array.isArray(routesDef)) {
17
            if (!Array.isArray(routesDef)) {
20
                routesDef = [routesDef]
18
                routesDef = [routesDef];
21
            }
19
            }
22
            this.routeState.children = routesDef
20
            this.routeState.children = routesDef;
23
            _traverseChildren(this.routeState)
21
            _traverseChildren(this.routeState);
24
22
25
            return this.navigationRoutes
23
            return this.navigationRoutes;
26
24
27
            // Function declarations
25
            // Function declarations
28
26
Lines 30-37 export const useNavigationStore = defineStore("navigation", { Link Here
30
                if (isParent(parent)) {
28
                if (isParent(parent)) {
31
                    parent.children.forEach(child => {
29
                    parent.children.forEach(child => {
32
                        _setChildDefaults(parent, child);
30
                        _setChildDefaults(parent, child);
33
                        _traverseChildren(child)
31
                        _traverseChildren(child);
34
                    })
32
                    });
35
                }
33
                }
36
            }
34
            }
37
35
Lines 43-96 export const useNavigationStore = defineStore("navigation", { Link Here
43
                if (parent.children.length === 1 && parent.is_base) {
41
                if (parent.children.length === 1 && parent.is_base) {
44
                    _setBaseAndNavigationDefaults(child, {
42
                    _setBaseAndNavigationDefaults(child, {
45
                        is_base: true,
43
                        is_base: true,
46
                        is_navigation_item: false
44
                        is_navigation_item: false,
47
                    });
45
                    });
48
                } else {
46
                } else {
49
                    _setBaseAndNavigationDefaults(child, {
47
                    _setBaseAndNavigationDefaults(child, {
50
                        is_base: false,
48
                        is_base: false,
51
                        is_navigation_item: true
49
                        is_navigation_item: true,
52
                    });
50
                    });
53
                }
51
                }
54
            }
52
            }
55
53
56
            function _setBaseAndNavigationDefaults(child, {
54
            function _setBaseAndNavigationDefaults(
57
                is_base,
55
                child,
58
                is_navigation_item
56
                { is_base, is_navigation_item }
59
            }) {
57
            ) {
60
                child.is_base = child.is_base !== undefined ? child.is_base : is_base;
58
                child.is_base =
61
                child.is_navigation_item = child.is_navigation_item !== undefined ? child.is_navigation_item : is_navigation_item;
59
                    child.is_base !== undefined ? child.is_base : is_base;
60
                child.is_navigation_item =
61
                    child.is_navigation_item !== undefined
62
                        ? child.is_navigation_item
63
                        : is_navigation_item;
62
            }
64
            }
63
65
64
            function _setMetadata(child) {
66
            function _setMetadata(child) {
65
                if (!child.meta)
67
                if (!child.meta) child.meta = {};
66
                    child.meta = {};
67
                child.meta.self = child;
68
                child.meta.self = child;
68
            }
69
            }
69
        }
70
        },
70
    },
71
    },
71
    getters: {
72
    getters: {
72
        breadcrumbs() {
73
        breadcrumbs() {
73
            if (this.current)
74
            if (this.current)
74
                return _buildFromCurrentMatches(this.current, this.routeState)
75
                return _buildFromCurrentMatches(this.current, this.routeState);
75
76
76
            return _getBaseElements(this.routeState)
77
            return _getBaseElements(this.routeState);
77
78
78
            // Function declarations
79
            // Function declarations
79
80
80
            function _getBaseElements(parent) {
81
            function _getBaseElements(parent) {
81
                if (!parent.is_base) return []
82
                if (!parent.is_base) return [];
82
                let next = {}
83
                let next = {};
83
                if (isParent(parent)) {
84
                if (isParent(parent)) {
84
                    next = _defineNextElement(parent)
85
                    next = _defineNextElement(parent);
85
                }
86
                }
86
                return [{
87
                return [
87
                    ...parent,
88
                    {
88
                    children: null
89
                        ...parent,
89
                }, ..._getBaseElements(next)]
90
                        children: null,
91
                    },
92
                    ..._getBaseElements(next),
93
                ];
90
            }
94
            }
91
95
92
            function _defineNextElement(parent) {
96
            function _defineNextElement(parent) {
93
                return parent.children.find(child => child.is_default) || parent.children[0];
97
                return (
98
                    parent.children.find(child => child.is_default) ||
99
                    parent.children[0]
100
                );
94
            }
101
            }
95
102
96
            function _buildFromCurrentMatches(currentMatches, routeState) {
103
            function _buildFromCurrentMatches(currentMatches, routeState) {
Lines 98-147 export const useNavigationStore = defineStore("navigation", { Link Here
98
                    {
105
                    {
99
                        ...routeState,
106
                        ...routeState,
100
                        icon: null,
107
                        icon: null,
101
                        children: null
108
                        children: null,
102
                    },
109
                    },
103
                    ..._mapMatches(currentMatches)
110
                    ..._mapMatches(currentMatches),
104
                ];
111
                ];
105
            }
112
            }
106
113
107
            function _isBaseOrNotStub(child) {
114
            function _isBaseOrNotStub(child) {
108
                return child.is_base || (child.path && child.path !== '');
115
                return child.is_base || (child.path && child.path !== "");
109
            }
116
            }
110
117
111
            function _mapMatches(currentMatches) {
118
            function _mapMatches(currentMatches) {
112
                return currentMatches
119
                return currentMatches
113
                    .filter((match) => _isBaseOrNotStub(match.meta.self))
120
                    .filter(match => _isBaseOrNotStub(match.meta.self))
114
                    .map((match) => ({
121
                    .map(match => ({
115
                        ...match.meta.self,
122
                        ...match.meta.self,
116
                        icon: null,
123
                        icon: null,
117
                        path: match.path,
124
                        path: match.path,
118
                        children: null
125
                        children: null,
119
                    }));
126
                    }));
120
            }
127
            }
121
122
        },
128
        },
123
        leftNavigation() {
129
        leftNavigation() {
124
            return _getNavigationElements(this.routeState)
130
            return _getNavigationElements(this.routeState);
125
131
126
            // Function declarations
132
            // Function declarations
127
133
128
            function _getNavigationElements(parent, prevPath = '') {
134
            function _getNavigationElements(parent, prevPath = "") {
129
                if (_isBaseAndNoChildren(parent)) return [];
135
                if (_isBaseAndNoChildren(parent)) return [];
130
                if (parent.is_base)
136
                if (parent.is_base)
131
                    return _buildChildNavigationElements(parent).flat(Infinity)
137
                    return _buildChildNavigationElements(parent).flat(Infinity);
132
138
133
                const builtPath = _buildPath(prevPath, parent);
139
                const builtPath = _buildPath(prevPath, parent);
134
140
135
                let children = []
141
                let children = [];
136
                if (!parent.is_end_node && isParent(parent)) {
142
                if (!parent.is_end_node && isParent(parent)) {
137
                    children = _buildChildNavigationElements(parent, builtPath)
143
                    children = _buildChildNavigationElements(parent, builtPath);
138
                }
144
                }
139
145
140
                return {
146
                return {
141
                    ...parent,
147
                    ...parent,
142
                    path: builtPath ? builtPath : parent.path,
148
                    path: builtPath ? builtPath : parent.path,
143
                    children
149
                    children,
144
                }
150
                };
145
            }
151
            }
146
152
147
            function _buildPath(prevPath, element) {
153
            function _buildPath(prevPath, element) {
Lines 151-159 export const useNavigationStore = defineStore("navigation", { Link Here
151
                    builtPath = element.path;
157
                    builtPath = element.path;
152
                } else {
158
                } else {
153
                    if (prevPath)
159
                    if (prevPath)
154
                        builtPath = '' + prevPath + addSlashIfNotPresent(prevPath);
160
                        builtPath =
161
                            "" + prevPath + addSlashIfNotPresent(prevPath);
155
                    if (isRoutable(element))
162
                    if (isRoutable(element))
156
                        builtPath = '' + builtPath + element.path;
163
                        builtPath = "" + builtPath + element.path;
157
                }
164
                }
158
165
159
                return builtPath;
166
                return builtPath;
Lines 166-184 export const useNavigationStore = defineStore("navigation", { Link Here
166
            }
173
            }
167
174
168
            function _isBaseAndNoChildren(parent) {
175
            function _isBaseAndNoChildren(parent) {
169
                return parent.is_base && (!parent.children || !parent.children.length);
176
                return (
177
                    parent.is_base &&
178
                    (!parent.children || !parent.children.length)
179
                );
170
            }
180
            }
171
        },
181
        },
172
        navigationRoutes() {
182
        navigationRoutes() {
173
            let routes = _toRoute(this.routeState)
183
            let routes = _toRoute(this.routeState);
174
            return Array.isArray(routes) ? routes : [routes]
184
            return Array.isArray(routes) ? routes : [routes];
175
185
176
            // Function declarations
186
            // Function declarations
177
187
178
            function _toRoute(parent) {
188
            function _toRoute(parent) {
179
                if (!isRoutable(parent))
189
                if (!isRoutable(parent)) return _getRoutableChildren(parent);
180
                    return _getRoutableChildren(parent)
190
                return parent;
181
                return parent
182
            }
191
            }
183
192
184
            function _getRoutableChildren(parent) {
193
            function _getRoutableChildren(parent) {
Lines 186-197 export const useNavigationStore = defineStore("navigation", { Link Here
186
                    .map(child => _toRoute(child))
195
                    .map(child => _toRoute(child))
187
                    .flat(Infinity);
196
                    .flat(Infinity);
188
            }
197
            }
189
        }
198
        },
190
    }
199
    },
191
})
200
});
192
201
193
function addSlashIfNotPresent(path) {
202
function addSlashIfNotPresent(path) {
194
    return /\/$/.test(path) ? '' : '/';
203
    return /\/$/.test(path) ? "" : "/";
195
}
204
}
196
205
197
function isRoutable(element) {
206
function isRoutable(element) {
198
- 

Return to bug 33169