Commit b7a80152 authored by Cornee Traas's avatar Cornee Traas
Browse files

More progress towards fixing up the menu

parent 2da3c32d
Pipeline #2504 failed with stages
in 1 minute and 9 seconds
......@@ -486,8 +486,8 @@ export default {
goUp: function() {
// If course page route to home
if (
settings.platforms.filter(el => {
return el.slug === this.$route.path.replace("/", "");
this.$store.state.platforms.filter(el => {
return el.id === this.$route.path.replace("/", "");
}).length > 0
) {
this.$router.push("home");
......@@ -517,13 +517,13 @@ export default {
var split = path.split("/");
//Set dropdown menus to the correct value
if (this.level >= 1) {
this.selectedPlatform = split[1];
if (this.level >= 2) {
this.selectedPlatform = split[2];
this.setCourses(this.courses.coursera, this.selectedPlatform);
this.selectedCourse = split[2];
this.selectedCourse = split[3];
this.$store.commit("setSelectedPlatform", this.selectedPlatform);
}
if (this.level >= 2) {
if (this.level >= 3) {
this.currentCourse = this.$store.state.user.courses.find(
x => x.course_slug === this.selectedCourse
);
......@@ -535,14 +535,14 @@ export default {
if (this.level === 0) {
// Home level
this.selectedPlatform = settings.platform_default;
} else if (this.level === 1) {
} else if (this.level === 2) {
// Course overview level.
this.selectedCourse = settings.course_default;
this.$store.commit("setCourses", this.courses.coursera);
} else if (this.level === 2) {
} else if (this.level === 3) {
// Course level
this.setCoursePages(path);
} else if (this.level === 3) {
} else if (this.level === 4) {
// Set subitem
this.selectedSubitem = split[3];
if (this.selectedSubitem === "videos") {
......@@ -600,11 +600,11 @@ export default {
for (var platform of this.platforms) {
this.top_nav[0].push({
name: platform.name,
url: platform.url || "/" + platform.slug,
url: "/p/" + platform.id,
icon: "fa fa-line-chart",
});
this.platformOptions.push({
value: platform.slug,
value: platform.id,
text: platform.name,
});
}
......@@ -616,7 +616,7 @@ export default {
text: strings.select_course,
},
];
this.top_nav[1] = [];
this.top_nav[2] = [];
for (var course of c) {
// Push to dropdown
this.courseOptions.push({
......@@ -624,7 +624,7 @@ export default {
text: course.name,
});
// Push to navbar
this.top_nav[1].push({
this.top_nav[2].push({
name: course.name,
url: "/" + this.selectedPlatform + "/" + course.slug,
icon: "fa fa-line-chart",
......@@ -632,9 +632,9 @@ export default {
}
},
setCoursePages() {
this.top_nav[2] = [];
this.top_nav[3] = [];
for (var coursepPage of settings.course_pages) {
this.top_nav[2].push({
this.top_nav[3].push({
name: coursepPage.name,
icon: coursepPage.icon,
url:
......@@ -651,10 +651,10 @@ export default {
util
.getVideos(this.currentCourse.course_id, this.$store.state.filters)
.then(response => {
this.top_nav[3] = [];
this.top_nav[4] = [];
for (var video of response.data) {
this.top_nav[3].push({
this.top_nav[4].push({
name: video.name,
url:
"/" +
......@@ -669,7 +669,7 @@ export default {
}
})
.catch(err => {
this.top_nav[3] = [];
this.top_nav[4] = [];
console.log(err);
});
},
......@@ -677,9 +677,9 @@ export default {
util
.getQuizzes(this.currentCourse.course_id, this.$store.state.filters)
.then(response => {
this.top_nav[3] = [];
this.top_nav[4] = [];
for (var quiz of response.data) {
this.top_nav[3].push({
this.top_nav[4].push({
name: quiz.name,
url:
"/" +
......@@ -696,7 +696,7 @@ export default {
}
})
.catch(err => {
this.top_nav[3] = [];
this.top_nav[4] = [];
console.log(err);
});
},
......@@ -704,12 +704,12 @@ export default {
util
.getAssignments(this.currentCourse.course_id, this.$store.state.filters)
.then(response => {
this.top_nav[3] = [];
this.top_nav[4] = [];
if (response.data.length == 0) {
this.$forceUpdate();
} else
for (var assignment of response.data) {
this.top_nav[3].push({
this.top_nav[4].push({
name: assignment.name,
url:
"/" +
......@@ -724,7 +724,7 @@ export default {
}
})
.catch(err => {
this.top_nav[3] = [];
this.top_nav[4] = [];
console.log(err);
});
},
......
......@@ -38,149 +38,149 @@ const router = new VueRouter({
y: 0,
}),
routes: [{
path: '/',
name: 'Home',
redirect: '/home',
component: DefaultContainer,
props: {
level: level,
},
children: [{
path: '/home',
component: Home,
},
{
path: '/coursera',
redirect: '/coursera',
name: 'Coursera',
component: Platform,
children: [{
path: '/coursera',
name: '',
component: coursera.Courses,
}, {
path: '/coursera/:courseid',
name: 'CourseDetail',
component: coursera.CourseDetail,
meta: {
label: "Course Details",
},
path: '/',
name: 'Home',
redirect: '/home',
component: DefaultContainer,
props: {
level: level,
},
{
path: '/coursera/:courseid/compare/:course2id',
name: 'CourseComparison',
component: coursera.CourseComparison,
meta: {
label: "Course Compare",
children: [{
path: '/home',
component: Home,
},
},
{
path: '/coursera/:courseid/videos',
name: 'Videos',
component: coursera.Videos,
},
{
path: '/coursera/:courseid/videos/:videoid',
name: 'VideoDetail',
component: coursera.VideoDetail,
meta: {
label: "Video Details",
{
path: '/p/:platform',
redirect: '/p/:platform',
name: 'Coursera',
component: Platform,
children: [{
path: '/p/:platform',
name: '',
component: coursera.Courses,
}, {
path: '/p/:platform/:courseid',
name: 'CourseDetail',
component: coursera.CourseDetail,
meta: {
label: "Course Details",
},
},
{
path: '/p/:platform/:courseid/compare/:course2id',
name: 'CourseComparison',
component: coursera.CourseComparison,
meta: {
label: "Course Compare",
},
},
{
path: '/p/:platform/:courseid/videos',
name: 'Videos',
component: coursera.Videos,
},
{
path: '/p/:platform/:courseid/videos/:videoid',
name: 'VideoDetail',
component: coursera.VideoDetail,
meta: {
label: "Video Details",
},
},
{
path: '/p/:platform/:courseid/quizzes',
name: 'Quizzes',
component: coursera.Quizzes,
},
{
path: '/p/:platform/:courseid/quizzes/:quizid',
name: 'QuizDetail',
component: coursera.QuizDetail,
meta: {
label: "Quiz Details",
},
},
{
path: '/p/:platform/:courseid/assignments',
name: 'Assignments',
component: coursera.Assignments,
},
{
path: '/p/:platform/:courseid/assignments/:assignmentid',
name: 'Assignment Details',
component: coursera.AssignmentDetail,
},
],
}, {
path: '/settings',
name: 'Settings',
component: Settings,
},
},
{
path: '/coursera/:courseid/quizzes',
name: 'Quizzes',
component: coursera.Quizzes,
},
{
path: '/coursera/:courseid/quizzes/:quizid',
name: 'QuizDetail',
component: coursera.QuizDetail,
meta: {
label: "Quiz Details",
{
path: '/contact',
name: 'Contact',
component: Contact,
},
},
{
path: '/coursera/:courseid/assignments',
name: 'Assignments',
component: coursera.Assignments,
},
{
path: '/coursera/:courseid/assignments/:assignmentid',
name: 'Assignment Details',
component: coursera.AssignmentDetail,
},
],
}, {
path: '/settings',
name: 'Settings',
component: Settings,
},
{
path: '/contact',
name: 'Contact',
component: Contact,
},
],
},
{
path: '/pages',
redirect: '/pages/404',
name: 'Pages',
component: {
render(c) {
return c('router-view')
path: '/pages',
redirect: '/pages/404',
name: 'Pages',
component: {
render(c) {
return c('router-view')
},
},
},
children: [{
path: '404',
name: 'Page404',
component: Page404,
},
{
path: '500',
name: 'Page500',
component: Page500,
},
{
path: 'login',
name: 'Login',
component: Login,
},
{
path: 'resetpassword/:token/:id',
name: 'ResetPasswordReferrer',
component: ResetReferrer,
},
{
path: 'resetpassword',
name: 'ResetPassword',
component: ResetPassword,
},
{
path: 'forgotpassword',
name: 'ForgotPassword',
component: ForgotPassword,
},
],
},
{
path: '/admin',
name: 'Admin',
component: AdminPanel,
redirect: 'admin/home',
children: [{
path: 'home',
name: 'AdminHome',
component: AdminHome,
children: [{
path: '404',
name: 'Page404',
component: Page404,
},
{
path: '500',
name: 'Page500',
component: Page500,
},
{
path: 'login',
name: 'Login',
component: Login,
},
{
path: 'resetpassword/:token/:id',
name: 'ResetPasswordReferrer',
component: ResetReferrer,
},
{
path: 'resetpassword',
name: 'ResetPassword',
component: ResetPassword,
},
{
path: 'forgotpassword',
name: 'ForgotPassword',
component: ForgotPassword,
},
],
},
{
path: 'register',
name: 'Register',
component: Register,
path: '/admin',
name: 'Admin',
component: AdminPanel,
redirect: 'admin/home',
children: [{
path: 'home',
name: 'AdminHome',
component: AdminHome,
},
{
path: 'register',
name: 'Register',
component: Register,
},
],
},
],
},
],
})
......
......@@ -23,7 +23,7 @@ export default {
// Constants
quiz_id: 5,
video_id: 1,
max_nav_level: 3,
max_nav_level: 4,
course_default: "course-select",
platform_default: "platform-select",
roles: [{
......
......@@ -175,7 +175,7 @@ export default {
})
},
getCoursesData(platform, filters) {
getCoursesData(filters, platform = store.state.selectedPlatform) {
return axios
.get(this.platformUrl(platform) + `/course-analytics/` + this.getQueryParams(filters), {
headers: this.authHeader(),
......@@ -244,21 +244,21 @@ export default {
// Actions API calls
getActions(platformId, courseId, filters) {
return axios
.get(this.platformUrl() + `/actions/${courseId}/` + this.getQueryParams(filters), {
.get(this.apiUrl() + `/actions/${store.state.selectedPlatform}/${courseId}/` + this.getQueryParams(filters), {
headers: this.authHeader(),
})
},
saveAction(action) {
return axios
.post(this.platformUrl() + `/actions/`, action, {
.post(this.apiUrl() + `/actions/${store.state.selectedPlatform}/`, action, {
headers: this.authHeader(),
})
},
deleteAction(pk) {
return axios
.delete(this.platformUrl() + `/actions/${pk}` + '/', {
.delete(this.apiUrl() + `/actions/${pk}/`, {
headers: this.authHeader(),
})
},
......
......@@ -9,7 +9,7 @@
>
<b-card class="bg" no-body>
<b-card-header>
<router-link :to="platform.name.toLowerCase()">
<router-link :to="'/p/' + platform.id">
<h4>{{platform.name}}</h4>
</router-link>
</b-card-header>
......@@ -59,7 +59,7 @@
<b-card no-body>
<b-card-header class="bg-primary">
<router-link
:to="'/coursera/'+course.slug"
:to="'/p/'+platform.id+'/'+course.slug"
class="link-light font-weight-bold"
>{{ course.name }}</router-link>
</b-card-header>
......@@ -189,7 +189,7 @@ export default {
beforeMount() {
for (let platform of this.$store.state.platforms) {
util
.getCoursesData(platform.id, this.$store.state.filters)
.getCoursesData(this.$store.state.filters, platform.id)
.then(response => {
this.$set(this.coursesCoursera, platform.id, response.data);
this.$set(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment