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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Breadcrumb.vue (-42 lines)
Lines 1-42 Link Here
1
<template>
2
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
3
        <ol>
4
            <li v-for="(item, counter) in breadCrumbs" v-bind:key="counter">
5
                <router-link
6
                    v-if="!item.path && counter == breadCrumbs.length - 1"
7
                    :to="`${currentRoute}`"
8
                >
9
                    {{ $__(item.text) }}</router-link
10
                >
11
                <router-link v-else-if="item.path" :to="item.path">
12
                    {{ $__(item.text) }}</router-link
13
                >
14
                <a v-else class="disabled"> {{ $__(item.text) }}</a>
15
            </li>
16
        </ol>
17
    </nav>
18
</template>
19
20
<script>
21
import { useRouter } from "vue-router"
22
export default {
23
    computed: {
24
        breadCrumbs() {
25
            if (this.$route.meta.breadcrumb) {
26
                return this.$route.meta.breadcrumb()
27
            }
28
        },
29
        currentRoute() {
30
            return this.$route.path
31
        },
32
    },
33
}
34
</script>
35
36
<style scoped>
37
a.disabled {
38
    padding: 0.6em 0.3em;
39
    text-decoration: none;
40
    color: #000;
41
}
42
</style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue (-46 / +16 lines)
Lines 1-6 Link Here
1
<template>
1
<template>
2
    <div v-if="initialized && PreservationModule == 1">
2
    <div v-if="initialized && PreservationModule == 1">
3
        <Breadcrumb />
3
        <div id="sub-header">
4
            <Breadcrumbs />
5
            <Help />
6
        </div>
4
        <div class="main container-fluid">
7
        <div class="main container-fluid">
5
            <div class="row">
8
            <div class="row">
6
                <div class="col-sm-10 col-sm-push-2">
9
                <div class="col-sm-10 col-sm-push-2">
Lines 11-53 Link Here
11
                </div>
14
                </div>
12
15
13
                <div class="col-sm-2 col-sm-pull-10">
16
                <div class="col-sm-2 col-sm-pull-10">
14
                    <aside>
17
                    <LeftMenu :title="$__('Preservation')"></LeftMenu>
15
                        <div id="navmenu">
16
                            <div id="navmenulist">
17
                                <h5>{{ $__("Preservation") }}</h5>
18
                                <ul>
19
                                    <li>
20
                                        <router-link :to="{ name: 'Home' }">
21
                                            <i class="fa fa-home"></i>
22
                                            {{ $__("Home") }}</router-link
23
                                        >
24
                                    </li>
25
                                    <li>
26
                                        <router-link
27
                                            :to="{ name: 'TrainsList' }"
28
                                        >
29
                                            <i class="fa fa-train"></i>
30
                                            {{ $__("Trains") }}</router-link
31
                                        >
32
                                    </li>
33
                                    <li>
34
                                        <router-link
35
                                            :to="{ name: 'WaitingList' }"
36
                                        >
37
                                            <i class="fa fa-recycle"></i>
38
                                            {{ $__("Waiting list") }}
39
                                        </router-link>
40
                                    </li>
41
                                    <li>
42
                                        <router-link :to="{ name: 'Settings' }">
43
                                            <i class="fa fa-cog"></i>
44
                                            {{ $__("Settings") }}
45
                                        </router-link>
46
                                    </li>
47
                                </ul>
48
                            </div>
49
                        </div>
50
                    </aside>
51
                </div>
18
                </div>
52
            </div>
19
            </div>
53
        </div>
20
        </div>
Lines 59-65 Link Here
59
26
60
<script>
27
<script>
61
import { inject } from "vue"
28
import { inject } from "vue"
62
import Breadcrumb from "../Breadcrumb.vue"
29
import Breadcrumbs from "../Breadcrumbs.vue"
30
import Help from "../Help.vue"
31
import LeftMenu from "../LeftMenu.vue"
63
import Dialog from "../Dialog.vue"
32
import Dialog from "../Dialog.vue"
64
import { APIClient } from "../../fetch/api-client.js"
33
import { APIClient } from "../../fetch/api-client.js"
65
import "vue-select/dist/vue-select.css"
34
import "vue-select/dist/vue-select.css"
Lines 145-160 export default { Link Here
145
    },
114
    },
146
115
147
    components: {
116
    components: {
148
        Breadcrumb,
117
        Breadcrumbs,
149
        Dialog,
118
        Dialog,
119
        Help,
120
        LeftMenu,
150
    },
121
    },
151
}
122
}
152
</script>
123
</script>
153
124
154
<style>
125
<style>
155
#navmenulist a.router-link-active {
156
    font-weight: 700;
157
}
158
#menu ul ul,
126
#menu ul ul,
159
#navmenulist ul ul {
127
#navmenulist ul ul {
160
    padding-left: 2em;
128
    padding-left: 2em;
Lines 179-190 textarea { Link Here
179
    width: 30%;
147
    width: 30%;
180
}
148
}
181
149
150
#navmenulist ul li a.current.disabled {
151
    background-color: inherit;
152
    border-left: 5px solid #e6e6e6;
153
    color: #000;
154
}
182
#navmenulist ul li a.disabled {
155
#navmenulist ul li a.disabled {
183
    color: #666;
156
    color: #666;
184
    pointer-events: none;
157
    pointer-events: none;
185
    font-weight: 700;
158
    font-weight: 700;
186
}
159
}
187
#navmenulist ul li a.disabled.router-link-active {
188
    color: #000;
189
}
190
</style>
160
</style>
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/preservation.ts (-15 / +14 lines)
Lines 29-55 library.add( Link Here
29
29
30
import App from "../components/Preservation/Main.vue";
30
import App from "../components/Preservation/Main.vue";
31
31
32
import { routes } from "../routes/preservation";
32
import { routes as routesDef } from "../routes/preservation";
33
34
const router = createRouter({
35
    history: createWebHistory(),
36
    linkActiveClass: "current",
37
    routes,
38
});
39
33
40
import { useMainStore } from "../stores/main";
34
import { useMainStore } from "../stores/main";
41
import { useAVStore } from "../stores/authorised-values";
35
import { useAVStore } from "../stores/authorised-values";
42
import { usePreservationStore } from "../stores/preservation";
36
import { usePreservationStore } from "../stores/preservation";
37
import { useNavigationStore } from "../stores/navigation";
38
import i18n from "../i18n";
43
39
44
const pinia = createPinia();
40
const pinia = createPinia();
45
41
46
const i18n = {
42
const mainStore = useMainStore(pinia);
47
    install: (app, options) => {
43
const navigationStore = useNavigationStore(pinia);
48
        app.config.globalProperties.$__ = key => {
44
const routes = navigationStore.setRoutes(routesDef);
49
            return window["__"](key);
45
50
        };
46
const router = createRouter({
51
    },
47
    history: createWebHistory(),
52
};
48
    linkExactActiveClass: "current",
49
    routes,
50
});
53
51
54
const app = createApp(App);
52
const app = createApp(App);
55
53
Lines 61-68 const rootComponent = app Link Here
61
    .component("v-select", vSelect);
59
    .component("v-select", vSelect);
62
60
63
app.config.unwrapInjectedRef = true;
61
app.config.unwrapInjectedRef = true;
64
const mainStore = useMainStore(pinia);
65
app.provide("mainStore", mainStore);
62
app.provide("mainStore", mainStore);
63
app.provide("navigationStore", navigationStore);
66
app.provide("AVStore", useAVStore(pinia));
64
app.provide("AVStore", useAVStore(pinia));
67
app.provide("PreservationStore", usePreservationStore(pinia));
65
app.provide("PreservationStore", usePreservationStore(pinia));
68
66
Lines 70-74 app.mount("#preservation"); Link Here
70
68
71
const { removeMessages } = mainStore;
69
const { removeMessages } = mainStore;
72
router.beforeEach((to, from) => {
70
router.beforeEach((to, from) => {
71
    navigationStore.$patch({ current: to.matched, params: to.params || {} });
73
    removeMessages(); // This will actually flag the messages as displayed already
72
    removeMessages(); // This will actually flag the messages as displayed already
74
});
73
});
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js (-193 / +96 lines)
Lines 1-3 Link Here
1
import { markRaw } from "vue";
2
1
import Home from "../components/Preservation/Home.vue";
3
import Home from "../components/Preservation/Home.vue";
2
import TrainsList from "../components/Preservation/TrainsList.vue";
4
import TrainsList from "../components/Preservation/TrainsList.vue";
3
import TrainsShow from "../components/Preservation/TrainsShow.vue";
5
import TrainsShow from "../components/Preservation/TrainsShow.vue";
Lines 9-242 import Settings from "../components/Preservation/Settings.vue"; Link Here
9
import SettingsProcessingsShow from "../components/Preservation/SettingsProcessingsShow.vue";
11
import SettingsProcessingsShow from "../components/Preservation/SettingsProcessingsShow.vue";
10
import SettingsProcessingsFormAdd from "../components/Preservation/SettingsProcessingsFormAdd.vue";
12
import SettingsProcessingsFormAdd from "../components/Preservation/SettingsProcessingsFormAdd.vue";
11
13
12
const breadcrumbs = {
14
import { $__ } from "../i18n";
13
    home: {
14
        text: "Home", // $t("Home")
15
        path: "/cgi-bin/koha/mainpage.pl",
16
    },
17
    preservation_home: {
18
        text: "Preservation", //$t("Preservation")
19
        path: "/cgi-bin/koha/preservation/home.pl",
20
    },
21
    trains: {
22
        text: "Trains", // $t("Trains")
23
        path: "/cgi-bin/koha/preservation/trains",
24
    },
25
    waiting_list: {
26
        text: "Waiting list", // $t("Waiting list")
27
        path: "/cgi-bin/koha/preservation/waiting-list",
28
    },
29
    settings: {
30
        home: {
31
            text: "Settings", // $t("Settings")
32
            path: "/cgi-bin/koha/preservation/settings",
33
        },
34
        processings: {
35
            home: {
36
                text: "Processings", //$t("Processings")
37
            },
38
        },
39
    },
40
};
41
const breadcrumb_paths = {
42
    trains: [
43
        breadcrumbs.home,
44
        breadcrumbs.preservation_home,
45
        breadcrumbs.trains,
46
    ],
47
    settings: [
48
        breadcrumbs.home,
49
        breadcrumbs.preservation_home,
50
        breadcrumbs.settings.home,
51
    ],
52
    settings_processings: [
53
        breadcrumbs.home,
54
        breadcrumbs.preservation_home,
55
        breadcrumbs.settings.home,
56
    ],
57
};
58
59
function build_breadcrumb(parent_breadcrumb, current) {
60
    let breadcrumb = parent_breadcrumb.flat(Infinity);
61
    if (current) {
62
        breadcrumb.push({
63
            text: current,
64
        });
65
    }
66
    return breadcrumb;
67
}
68
15
69
export const routes = [
16
export const routes = [
70
    {
17
    {
71
        path: "/cgi-bin/koha/mainpage.pl",
18
        path: "/cgi-bin/koha/mainpage.pl",
19
        is_base: true,
72
        beforeEnter(to, from, next) {
20
        beforeEnter(to, from, next) {
73
            window.location.href = "/cgi-bin/koha/mainpage.pl";
21
            window.location.href = "/cgi-bin/koha/mainpage.pl";
74
        },
22
        },
75
    },
23
    },
76
    {
24
    {
77
        path: "/cgi-bin/koha/preservation/home.pl",
25
        path: "/cgi-bin/koha/preservation/home.pl",
78
        name: "Home",
26
        is_default: true,
79
        component: Home,
27
        is_base: true,
80
        meta: {
28
        title: $__("Preservation"),
81
            breadcrumb: () => [breadcrumbs.home, breadcrumbs.preservation_home],
82
        },
83
    },
84
    {
85
        path: "/cgi-bin/koha/preservation/trains",
86
        children: [
29
        children: [
87
            {
30
            {
88
                path: "",
31
                path: "",
89
                name: "TrainsList",
32
                name: "Home",
90
                component: TrainsList,
33
                component: markRaw(Home),
91
                meta: {
34
                title: $__("Home"),
92
                    breadcrumb: () => breadcrumb_paths.trains,
35
                icon: "fa fa-home",
93
                },
94
            },
36
            },
95
            {
37
            {
96
                path: ":train_id",
38
                path: "/cgi-bin/koha/preservation/trains",
39
                title: $__("Trains"),
40
                icon: "fa fa-train",
41
                is_end_node: true,
97
                children: [
42
                children: [
98
                    {
43
                    {
99
                        path: "",
44
                        path: "",
100
                        name: "TrainsShow",
45
                        name: "TrainsList",
101
                        component: TrainsShow,
46
                        component: markRaw(TrainsList),
102
                        meta: {
103
                            breadcrumb: () =>
104
                                build_breadcrumb(
105
                                    breadcrumb_paths.trains,
106
                                    "Show train" // $t("Show train")
107
                                ),
108
                        },
109
                    },
47
                    },
110
                    {
48
                    {
111
                        path: "items",
49
                        path: ":train_id",
50
                        title: $__("Show train"),
51
                        is_end_node: true,
112
                        children: [
52
                        children: [
113
                            {
53
                            {
114
                                path: "add",
54
                                path: "",
115
                                name: "TrainsFormAddItem",
55
                                name: "TrainsShow",
116
                                component: TrainsFormAddItem,
56
                                component: markRaw(TrainsShow),
117
                                meta: {
118
                                    breadcrumb: () =>
119
                                        build_breadcrumb(
120
                                            breadcrumb_paths.trains,
121
                                            "Add item to train" // $t("Add item to train")
122
                                        ),
123
                                },
124
                            },
125
                            {
126
                                path: "add/:item_ids",
127
                                name: "TrainsFormAddItems",
128
                                component: TrainsFormAddItems,
129
                                meta: {
130
                                    breadcrumb: () =>
131
                                        build_breadcrumb(
132
                                            breadcrumb_paths.trains,
133
                                            "Add items to train" // $t("Add items to train")
134
                                        ),
135
                                },
136
                            },
57
                            },
137
                            {
58
                            {
138
                                path: "edit/:train_item_id",
59
                                path: "items",
139
                                name: "TrainsFormEditItem",
60
                                is_empty: true,
140
                                component: TrainsFormAddItem,
61
                                children: [
141
                                meta: {
62
                                    {
142
                                    breadcrumb: () =>
63
                                        path: "add",
143
                                        build_breadcrumb(
64
                                        name: "TrainsFormAddItem",
144
                                            breadcrumb_paths.trains,
65
                                        component: markRaw(TrainsFormAddItem),
145
                                            "Edit item in train" // $t("Edit item in train")
66
                                        title: $__("Add item to train"),
146
                                        ),
67
                                    },
147
                                },
68
                                    {
69
                                        path: "add/:item_ids",
70
                                        name: "TrainsFormAddItems",
71
                                        component: markRaw(TrainsFormAddItems),
72
                                        title: $__("Add items to train"),
73
                                    },
74
                                    {
75
                                        path: "edit/:train_item_id",
76
                                        name: "TrainsFormEditItem",
77
                                        component: markRaw(TrainsFormAddItem),
78
                                        title: $__("Edit item in train"),
79
                                    },
80
                                ],
148
                            },
81
                            },
149
                        ],
82
                        ],
150
                    },
83
                    },
84
                    {
85
                        path: "add",
86
                        name: "TrainsFormAdd",
87
                        component: markRaw(TrainsFormAdd),
88
                        title: $__("Add train"),
89
                    },
90
                    {
91
                        path: "edit/:train_id",
92
                        name: "TrainsFormEdit",
93
                        component: markRaw(TrainsFormAdd),
94
                        title: $__("Edit train"),
95
                    },
151
                ],
96
                ],
152
            },
97
            },
153
            {
98
            {
154
                path: "add",
99
                path: "/cgi-bin/koha/preservation/waiting-list",
155
                name: "TrainsFormAdd",
100
                title: $__("Waiting List"),
156
                component: TrainsFormAdd,
101
                icon: "fa fa-recycle",
157
                meta: {
102
                is_end_node: true,
158
                    breadcrumb: () =>
159
                        build_breadcrumb(
160
                            breadcrumb_paths.trains,
161
                            "Add train" // $t("Add train")
162
                        ),
163
                },
164
            },
165
            {
166
                path: "edit/:train_id",
167
                name: "TrainsFormEdit",
168
                component: TrainsFormAdd,
169
                meta: {
170
                    breadcrumb: () =>
171
                        build_breadcrumb(
172
                            breadcrumb_paths.trains,
173
                            "Edit train" // $t("Edit train")
174
                        ),
175
                },
176
            },
177
        ],
178
    },
179
    {
180
        path: "/cgi-bin/koha/preservation/waiting-list",
181
        name: "WaitingList",
182
        component: WaitingList,
183
        meta: {
184
            breadcrumb: () => [
185
                breadcrumbs.home,
186
                breadcrumbs.preservation_home,
187
                breadcrumbs.waiting_list,
188
            ],
189
        },
190
    },
191
    {
192
        path: "/cgi-bin/koha/preservation/settings",
193
        children: [
194
            {
195
                path: "",
196
                name: "Settings",
197
                component: Settings,
198
                meta: {
199
                    breadcrumb: () => breadcrumb_paths.settings,
200
                },
201
            },
202
            {
203
                path: "processings",
204
                children: [
103
                children: [
205
                    {
104
                    {
206
                        path: ":processing_id",
105
                        path: "",
207
                        name: "SettingsProcessingsShow",
106
                        name: "WaitingList",
208
                        component: SettingsProcessingsShow,
107
                        component: markRaw(WaitingList),
209
                        meta: {
210
                            breadcrumb: () =>
211
                                build_breadcrumb(
212
                                    breadcrumb_paths.settings_processings,
213
                                    "Show processing" // $t("Show processing")
214
                                ),
215
                        },
216
                    },
108
                    },
109
                ],
110
            },
111
            {
112
                path: "/cgi-bin/koha/preservation/settings",
113
                title: $__("Settings"),
114
                icon: "fa fa-cog",
115
                is_end_node: true,
116
                children: [
217
                    {
117
                    {
218
                        path: "add",
118
                        path: "",
219
                        name: "SettingsProcessingsFormAdd",
119
                        name: "Settings",
220
                        component: SettingsProcessingsFormAdd,
120
                        component: markRaw(Settings),
221
                        meta: {
222
                            breadcrumb: () =>
223
                                build_breadcrumb(
224
                                    breadcrumb_paths.settings_processings,
225
                                    "Add processing" // $t("Add processing")
226
                                ),
227
                        },
228
                    },
121
                    },
229
                    {
122
                    {
230
                        path: "edit/:processing_id",
123
                        path: "processings",
231
                        name: "SettingsProcessingsFormEdit",
124
                        children: [
232
                        component: SettingsProcessingsFormAdd,
125
                            {
233
                        meta: {
126
                                path: ":processing_id",
234
                            breadcrumb: () =>
127
                                name: "SettingsProcessingsShow",
235
                                build_breadcrumb(
128
                                component: markRaw(SettingsProcessingsShow),
236
                                    breadcrumb_paths.settings_processings,
129
                                title: $__("Show processing"),
237
                                    "Edit processing" // $t("Edit processing")
130
                            },
238
                                ),
131
                            {
239
                        },
132
                                path: "add",
133
                                name: "SettingsProcessingsFormAdd",
134
                                component: markRaw(SettingsProcessingsFormAdd),
135
                                title: $__("Add processing"),
136
                            },
137
                            {
138
                                path: "edit/:processing_id",
139
                                name: "SettingsProcessingsFormEdit",
140
                                component: markRaw(SettingsProcessingsFormAdd),
141
                                title: $__("Edit processing"),
142
                            },
143
                        ],
240
                    },
144
                    },
241
                ],
145
                ],
242
            },
146
            },
243
- 

Return to bug 30708