From 1f973aa15fef1266a35d3b9f98bef8ff9c27ec53 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 20 Jan 2021 17:30:40 +0100 Subject: [PATCH] Disable portfolio based on env variable --- client/config/prod.env.js | 1 + .../book-navigation/ContentNavigation.vue | 10 +++++++++- client/src/pages/{ => portfolio}/editProject.vue | 0 client/src/pages/{ => portfolio}/newProject.vue | 0 client/src/pages/{ => portfolio}/portfolio.vue | 0 client/src/pages/{ => portfolio}/project.vue | 0 client/src/router/index.js | 10 ++-------- client/src/router/portfolio.routes.js | 15 +++++++++++++++ 8 files changed, 27 insertions(+), 9 deletions(-) rename client/src/pages/{ => portfolio}/editProject.vue (100%) rename client/src/pages/{ => portfolio}/newProject.vue (100%) rename client/src/pages/{ => portfolio}/portfolio.vue (100%) rename client/src/pages/{ => portfolio}/project.vue (100%) create mode 100644 client/src/router/portfolio.routes.js diff --git a/client/config/prod.env.js b/client/config/prod.env.js index 4b668998..8e155e54 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -9,6 +9,7 @@ module.exports = { * around strings */ VUE_APP_LOGO: JSON.stringify(process.env.VUE_APP_LOGO) || '"/static/logo.png"', + VUE_APP_ENABLE_PORTFOLIO: process.env.ENABLE_PORTFOLIO || "true", /* * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes */ diff --git a/client/src/components/book-navigation/ContentNavigation.vue b/client/src/components/book-navigation/ContentNavigation.vue index aa592927..8f70c187 100644 --- a/client/src/components/book-navigation/ContentNavigation.vue +++ b/client/src/components/book-navigation/ContentNavigation.vue @@ -57,7 +57,9 @@ -
+
-1; diff --git a/client/src/pages/editProject.vue b/client/src/pages/portfolio/editProject.vue similarity index 100% rename from client/src/pages/editProject.vue rename to client/src/pages/portfolio/editProject.vue diff --git a/client/src/pages/newProject.vue b/client/src/pages/portfolio/newProject.vue similarity index 100% rename from client/src/pages/newProject.vue rename to client/src/pages/portfolio/newProject.vue diff --git a/client/src/pages/portfolio.vue b/client/src/pages/portfolio/portfolio.vue similarity index 100% rename from client/src/pages/portfolio.vue rename to client/src/pages/portfolio/portfolio.vue diff --git a/client/src/pages/project.vue b/client/src/pages/portfolio/project.vue similarity index 100% rename from client/src/pages/project.vue rename to client/src/pages/portfolio/project.vue diff --git a/client/src/router/index.js b/client/src/router/index.js index 44cfb4bf..759df143 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -14,15 +14,11 @@ 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 myClass from '@/pages/myClass'; 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'; @@ -44,6 +40,7 @@ import onboardingStart from '@/pages/onboarding/start'; import onboardingStep1 from '@/pages/onboarding/step1'; import onboardingStep2 from '@/pages/onboarding/step2'; import onboardingStep3 from '@/pages/onboarding/step3'; +import portfolioRoutes from './portfolio.routes'; import store from '@/store/index'; @@ -121,10 +118,7 @@ const routes = [ }, {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}, + ...portfolioRoutes, {path: '/topic/:topicSlug', name: 'topic', component: topic, alias: '/book/topic/:topicSlug'}, { path: '/me', diff --git a/client/src/router/portfolio.routes.js b/client/src/router/portfolio.routes.js new file mode 100644 index 00000000..a63a115d --- /dev/null +++ b/client/src/router/portfolio.routes.js @@ -0,0 +1,15 @@ +import portfolio from '@/pages/portfolio/portfolio'; +import project from '@/pages/portfolio/project'; +import newProject from '@/pages/portfolio/newProject'; +import editProject from '@/pages/portfolio/editProject'; + +const portfolioRoutes = [ + {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}, +]; + +const routes = process.env.VUE_APP_ENABLE_PORTFOLIO ? portfolioRoutes : []; + +export default routes;