diff --git a/kolibri/plugins/coach/assets/src/app.js b/kolibri/plugins/coach/assets/src/app.js index c930f5b09e7..42b84b6e3a1 100644 --- a/kolibri/plugins/coach/assets/src/app.js +++ b/kolibri/plugins/coach/assets/src/app.js @@ -13,6 +13,7 @@ import GroupsPage from './views/plan/GroupsPage'; import GroupMembersPage from './views/plan/GroupMembersPage'; import GroupEnrollPage from './views/plan/GroupEnrollPage'; import pages from './views/reports/allReportsPages'; +import HomeActivityPage from './views/home/HomeActivityPage'; class CoachToolsModule extends KolibriApp { get stateSetters() { @@ -84,6 +85,8 @@ class CoachToolsModule extends KolibriApp { GroupsPage.name, GroupMembersPage.name, GroupEnrollPage.name, + PageNames.HOME_PAGE, + HomeActivityPage.name, ].includes(to.name) ) { next(); diff --git a/kolibri/plugins/coach/assets/src/routes/index.js b/kolibri/plugins/coach/assets/src/routes/index.js index a45c31ac2a1..3c75d9cdc49 100644 --- a/kolibri/plugins/coach/assets/src/routes/index.js +++ b/kolibri/plugins/coach/assets/src/routes/index.js @@ -13,6 +13,16 @@ import reportRoutes from './reportRoutes'; import planRoutes from './planRoutes'; import { classIdParamRequiredGuard } from './utils'; +function showHomePage(toRoute) { + const initClassInfoPromise = store.dispatch('initClassInfo', toRoute.params.classId); + const getFacilitiesPromise = + store.getters.isSuperuser && store.state.core.facilities.length === 0 + ? store.dispatch('getFacilities').catch(() => {}) + : Promise.resolve(); + + return Promise.all([initClassInfoPromise, getFacilitiesPromise]); +} + export default [ ...planRoutes, ...reportRoutes, @@ -58,10 +68,11 @@ export default [ name: PageNames.HOME_PAGE, path: '/:classId?/home', component: HomePage, - handler: (toRoute, fromRoute, next) => { + handler: async (toRoute, fromRoute, next) => { if (classIdParamRequiredGuard(toRoute, HomePage.name, next)) { return; } + await showHomePage(toRoute); store.dispatch('notLoading'); }, meta: { @@ -71,7 +82,8 @@ export default [ { path: '/:classId/home/activity', component: HomeActivityPage, - handler() { + handler: async (toRoute, fromRoute, next) => { + await showHomePage(toRoute); store.dispatch('notLoading'); }, meta: { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/QuestionListPreview.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/QuestionListPreview.vue index 90da8c4c283..40e1610e562 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/QuestionListPreview.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/QuestionListPreview.vue @@ -79,17 +79,19 @@