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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js (-11 / +30 lines)
Lines 72-78 export const useNavigationStore = defineStore("navigation", { Link Here
72
    getters: {
72
    getters: {
73
        breadcrumbs() {
73
        breadcrumbs() {
74
            if (this.current)
74
            if (this.current)
75
                return _buildFromCurrentMatches(this.current, this.routeState);
75
                return _buildFromCurrentMatches(
76
                    this.current,
77
                    this.routeState,
78
                    this.params
79
                );
76
80
77
            return _getBaseElements(this.routeState);
81
            return _getBaseElements(this.routeState);
78
82
Lines 100-113 export const useNavigationStore = defineStore("navigation", { Link Here
100
                );
104
                );
101
            }
105
            }
102
106
103
            function _buildFromCurrentMatches(currentMatches, routeState) {
107
            function _buildFromCurrentMatches(
108
                currentMatches,
109
                routeState,
110
                params
111
            ) {
104
                return [
112
                return [
105
                    {
113
                    {
106
                        ...routeState,
114
                        ...routeState,
107
                        icon: null,
115
                        icon: null,
108
                        children: null,
116
                        children: null,
109
                    },
117
                    },
110
                    ..._mapMatches(currentMatches),
118
                    ..._mapMatches(currentMatches, params),
111
                ];
119
                ];
112
            }
120
            }
113
121
Lines 119-134 export const useNavigationStore = defineStore("navigation", { Link Here
119
                return !child.is_empty;
127
                return !child.is_empty;
120
            }
128
            }
121
129
122
            function _mapMatches(currentMatches) {
130
            function _getPath(match, params) {
131
                if (!match.name && match.path && params) {
132
                    return match.path.replaceAll(/(:[^/]+)/g, param_name => {
133
                        return params[param_name.substr(1)];
134
                    });
135
                }
136
                return match.path;
137
            }
138
139
            function _mapMatches(currentMatches, params) {
123
                return currentMatches
140
                return currentMatches
124
                    .filter(match => _isBaseOrNotStub(match.meta.self))
141
                    .filter(match => _isBaseOrNotStub(match.meta.self))
125
                    .filter(match => _isEmptyNode(match.meta.self))
142
                    .filter(match => _isEmptyNode(match.meta.self))
126
                    .map(match => ({
143
                    .map(match => {
127
                        ...match.meta.self,
144
                        let path = _getPath(match, params);
128
                        icon: null,
145
                        return {
129
                        path: match.path,
146
                            ...match.meta.self,
130
                        children: null,
147
                            icon: null,
131
                    }));
148
                            path,
149
                            children: null,
150
                        };
151
                    });
132
            }
152
            }
133
        },
153
        },
134
        leftNavigation() {
154
        leftNavigation() {
135
- 

Return to bug 34418