141 lines
4.1 KiB
JavaScript
141 lines
4.1 KiB
JavaScript
import Vue from 'vue'
|
|
// import index from '@/pages/index'
|
|
import topic from '@/pages/topic'
|
|
import book from '@/pages/book'
|
|
import moduleBase from '@/pages/module-base'
|
|
import module from '@/pages/module'
|
|
import rooms from '@/pages/rooms'
|
|
import room from '@/pages/room'
|
|
import newRoom from '@/pages/newRoom'
|
|
import editRoom from '@/pages/editRoom'
|
|
import article from '@/pages/article'
|
|
import instrument from '@/pages/instrument'
|
|
import instrumentOverview from '@/pages/instrumentOverview'
|
|
import submissions from '@/pages/submissions'
|
|
import p404 from '@/pages/p404'
|
|
import start from '@/pages/start'
|
|
import submission from '@/pages/studentSubmission'
|
|
import portfolio from '@/pages/portfolio'
|
|
import project from '@/pages/project'
|
|
import profilePage from '@/pages/profile'
|
|
import profile from '@/components/profile/Profile'
|
|
import myClasses from '@/pages/myClasses'
|
|
import activity from '@/pages/activity'
|
|
import Router from 'vue-router'
|
|
import editProject from '@/pages/editProject'
|
|
import newProject from '@/pages/newProject'
|
|
import surveyPage from '@/pages/survey'
|
|
import styleGuidePage from '@/pages/styleguide'
|
|
import moduleRoom from '@/pages/moduleRoom'
|
|
import login from '@/pages/login'
|
|
|
|
import store from '@/store/index';
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'home',
|
|
component: start,
|
|
meta: {layout: 'blank'}
|
|
},
|
|
{
|
|
path: '/login',
|
|
name: 'login',
|
|
component: login,
|
|
meta: {
|
|
layout: 'public',
|
|
public: true
|
|
}
|
|
},
|
|
{
|
|
path: '/module/:slug',
|
|
component: moduleBase,
|
|
children: [
|
|
{
|
|
path: '',
|
|
name: 'module',
|
|
component: module,
|
|
meta: {filter: true}
|
|
},
|
|
{
|
|
path: 'submissions/:id',
|
|
name: 'submissions',
|
|
component: submissions,
|
|
meta: {filter: true}
|
|
}
|
|
]
|
|
},
|
|
{path: '/rooms', name: 'rooms', component: rooms, meta: {filter: true}},
|
|
{path: '/new-room/', name: 'new-room', component: newRoom},
|
|
{path: '/edit-room/:id', name: 'edit-room', component: editRoom, props: true},
|
|
{path: '/room/:slug', name: 'room', component: room, props: true},
|
|
{
|
|
path: '/module-room/:slug',
|
|
name: 'moduleRoom',
|
|
component: moduleRoom,
|
|
props: true,
|
|
meta: {layout: 'fullScreen'}
|
|
},
|
|
{path: '/article/:slug', name: 'article', component: article, meta: {layout: 'simple'}},
|
|
{
|
|
path: '/instruments/:slug',
|
|
name: 'instrument-overview',
|
|
component: instrumentOverview,
|
|
meta: {subnavigation: true}
|
|
},
|
|
{path: '/instrument/:slug', name: 'instrument', component: instrument, meta: {layout: 'simple'}},
|
|
{path: '/submission/:id', name: 'submission', component: submission, meta: {layout: 'simple'}},
|
|
{path: '/portfolio', name: 'portfolio', component: portfolio},
|
|
{path: '/portfolio/:slug', name: 'project', component: project, props: true},
|
|
{path: '/new-project/', name: 'new-project', component: newProject},
|
|
{path: '/edit-project/:id', name: 'edit-project', component: editProject, props: true},
|
|
{
|
|
path: '/book',
|
|
name: 'book',
|
|
component: book,
|
|
meta: {
|
|
subnavigation: true
|
|
},
|
|
children: [
|
|
{path: 'topic/:topicSlug', name: 'topic', component: topic, meta: {subnavigation: true}}
|
|
]
|
|
},
|
|
{
|
|
path: '/me',
|
|
component: profilePage,
|
|
children: [
|
|
{path: 'profile', name: 'profile', component: profile, meta: {isProfile: true}},
|
|
{path: 'myclasses', name: 'my-classes', component: myClasses, meta: {isProfile: true}},
|
|
{path: 'activity', name: 'activity', component: activity, meta: {isProfile: true}},
|
|
{path: '', name: 'profile-activity', component: activity, meta: {isProfile: true}},
|
|
]
|
|
},
|
|
{
|
|
path: '/survey/:id',
|
|
component: surveyPage,
|
|
name: 'survey',
|
|
props: true,
|
|
meta: {layout: 'simple'}
|
|
},
|
|
{path: '/styleguide', component: styleGuidePage},
|
|
{path: '*', component: p404}
|
|
];
|
|
|
|
Vue.use(Router);
|
|
|
|
const router = new Router({
|
|
routes,
|
|
mode: 'history',
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (savedPosition) {
|
|
return savedPosition
|
|
}
|
|
return {x: 0, y: 0}
|
|
}
|
|
});
|
|
|
|
router.afterEach((to, from) => {
|
|
store.dispatch('showMobileNavigation', false);
|
|
});
|
|
export default router;
|