Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coach routing - handle lesson creation and deletion #11283

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,5 @@ export function showExamCreationQuestionSelectionPage(store, toRoute, fromRoute)
store.commit('SET_PAGE_NAME', 'EXAM_CREATION_QUESTION_SELECTION');
store.commit('SET_TOOLBAR_ROUTE', { name: fromRoute.name, params: fromRoute.params });
store.dispatch('examCreation/updateSelectedQuestions');
store.dispatch('notLoading');
}
5 changes: 3 additions & 2 deletions kolibri/plugins/coach/assets/src/routes/planLessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import LessonEditDetailsPage from '../views/plan/LessonEditDetailsPage';
import LessonCreationPage from '../views/plan/LessonCreationPage';
import { classIdParamRequiredGuard } from './utils';

const CLASS = '/:classId?/plan';
const OPTIONAL_CLASS = '/:classId?/plan';
const CLASS = '/:classId/plan';
const LESSON = '/lessons/:lessonId';
const ALL_LESSONS = '/lessons';
const SELECTION = '/selection';
Expand All @@ -39,7 +40,7 @@ const { showLessonsRootPage } = useLessons();
export default [
{
name: LessonsPageNames.PLAN_LESSONS_ROOT,
path: path(CLASS, ALL_LESSONS),
path: path(OPTIONAL_CLASS, ALL_LESSONS),
component: LessonsRootPage,
handler(toRoute, fromRoute, next) {
if (classIdParamRequiredGuard(toRoute, PageNames.PLAN_PAGE, next)) {
Expand Down
7 changes: 4 additions & 3 deletions kolibri/plugins/coach/assets/src/routes/reportRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import QuizEditDetailsPage from '../views/plan/QuizEditDetailsPage';
import { classIdParamRequiredGuard } from './utils';

const ACTIVITY = '/activity';
const CLASS = '/:classId?/reports';
const OPTIONAL_CLASS = '/:classId?/reports';
const CLASS = '/:classId/reports';
const GROUPS = '/groups';
const GROUP = '/groups/:groupId';
const LEARNERS = '/learners';
Expand Down Expand Up @@ -45,7 +46,7 @@ function defaultHandler() {
export default [
{
name: PageNames.REPORTS_PAGE,
path: path(CLASS),
path: path(OPTIONAL_CLASS),
redirect: { name: 'ReportsLessonListPage' },
},
{
Expand Down Expand Up @@ -444,7 +445,7 @@ export default [
},
},
{
path: path(CLASS, LESSONS),
path: path(OPTIONAL_CLASS, LESSONS),
component: pages.ReportsLessonListPage,
handler: (toRoute, fromRoute, next) => {
if (classIdParamRequiredGuard(toRoute, 'ReportsLessonListPage', next)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@
const { id } = this.currentLesson;
return LessonResource.deleteModel({ id })
.then(() => {
this.$router.replace(this.$router.getRoute('PLAN_LESSONS_ROOT'), () => {
this.showSnackbarNotification('lessonDeleted');
});
this.$router.replace(
this.$router.getRoute('PLAN_LESSONS_ROOT', { classId: this.classId }),
() => {
this.showSnackbarNotification('lessonDeleted');
}
);
})
.catch(error => {
this.$store.dispatch('handleApiError', { error });
Expand Down