|
7 | 7 | :tabsId="PLAN_TABS_ID"
|
8 | 8 | :activeTabId="PlanTabs.QUIZZES"
|
9 | 9 | >
|
| 10 | + <div |
| 11 | + v-if="hasNoChannels && !isLoading" |
| 12 | + class="alert banner-spacing" |
| 13 | + :style="{ backgroundColor: $themePalette.yellow.v_200 }" |
| 14 | + > |
| 15 | + <div> |
| 16 | + <KIcon |
| 17 | + icon="warning" |
| 18 | + class="warning-icon" |
| 19 | + :color="$themePalette.yellow.v_600" |
| 20 | + /> |
| 21 | + </div> |
| 22 | + |
| 23 | + <div |
| 24 | + v-if="hasNoChannels" |
| 25 | + class="error-message" |
| 26 | + > |
| 27 | + <p>{{ noResourcesAvailable$() }}</p> |
| 28 | + <KExternalLink |
| 29 | + v-if="deviceContentUrl" |
| 30 | + :text="$tr('adminLink')" |
| 31 | + :href="deviceContentUrl" |
| 32 | + /> |
| 33 | + </div> |
| 34 | + </div> |
10 | 35 | <div class="classname-quiz-button-div">
|
11 | 36 | <div>
|
12 | 37 | <KIcon
|
|
17 | 42 | </div>
|
18 | 43 | <KButtonGroup v-if="practiceQuizzesExist">
|
19 | 44 | <KButton
|
| 45 | + v-if="!hasNoChannels" |
20 | 46 | primary
|
21 | 47 | hasDropdown
|
22 | 48 | appearance="raised-button"
|
|
36 | 62 | class="button"
|
37 | 63 | >
|
38 | 64 | <KRouterLink
|
| 65 | + v-if="!hasNoChannels" |
39 | 66 | :primary="true"
|
40 | 67 | appearance="raised-button"
|
41 | 68 | :to="newExamRoute"
|
|
205 | 232 | import { getCurrentInstance, ref } from 'kolibri.lib.vueCompositionApi';
|
206 | 233 | import CoreTable from 'kolibri.coreVue.components.CoreTable';
|
207 | 234 | import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
|
208 |
| - import { ExamResource, UserSyncStatusResource } from 'kolibri.resources'; |
| 235 | + import { ExamResource, UserSyncStatusResource, ChannelResource } from 'kolibri.resources'; |
209 | 236 | import plugin_data from 'plugin_data';
|
210 | 237 | import bytesForHumans from 'kolibri.utils.bytesForHumans';
|
211 | 238 | import { mapState, mapGetters } from 'kolibri.lib.vuex';
|
212 | 239 | import useSnackbar from 'kolibri.coreVue.composables.useSnackbar';
|
| 240 | + import urls from 'kolibri.urls'; |
| 241 | + import useUser from 'kolibri.coreVue.composables.useUser'; |
| 242 | + import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; |
213 | 243 | import { PageNames } from '../../../constants';
|
214 | 244 | import { PLAN_TABS_ID, PlanTabs } from '../../../constants/tabsConstants';
|
215 | 245 | import { coachStrings } from '../../common/commonCoachStrings';
|
|
247 | 277 | const showCloseConfirmationModal = ref(false);
|
248 | 278 | const activeQuiz = ref(null);
|
249 | 279 | const learnOnlyDevicesExist = ref(false);
|
| 280 | + const { noResourcesAvailable$ } = enhancedQuizManagementStrings; |
| 281 | + const { canManageContent } = useUser(); |
250 | 282 |
|
251 | 283 | initClassInfo().then(() => store.dispatch('notLoading'));
|
252 | 284 |
|
|
329 | 361 | recipientsLabel$,
|
330 | 362 | sizeLabel$,
|
331 | 363 | canNoLongerEditQuizNotice$,
|
| 364 | + noResourcesAvailable$, |
332 | 365 | statusLabel$,
|
333 | 366 | newQuizAction$,
|
334 | 367 | filterQuizStatus$,
|
|
337 | 370 | avgScoreLabel$,
|
338 | 371 | entireClassLabel$,
|
339 | 372 | recipientSelected,
|
| 373 | + canManageContent, |
| 374 | + }; |
| 375 | + }, |
| 376 | + data() { |
| 377 | + return { |
| 378 | + channels: [], |
| 379 | + isLoading: true, |
340 | 380 | };
|
341 | 381 | },
|
342 | 382 | computed: {
|
|
458 | 498 | const size = bytesForHumans(sum);
|
459 | 499 | return size;
|
460 | 500 | },
|
| 501 | + deviceContentUrl() { |
| 502 | + const deviceContentUrl = urls['kolibri:kolibri.plugins.device:device_management']; |
| 503 | + if (deviceContentUrl && this.canManageContent) { |
| 504 | + return `${deviceContentUrl()}#/content`; |
| 505 | + } |
| 506 | +
|
| 507 | + return ''; |
| 508 | + }, |
| 509 | + hasNoChannels() { |
| 510 | + return this.channels.length === 0; |
| 511 | + }, |
461 | 512 | },
|
462 | 513 | mounted() {
|
| 514 | + this.fetchResources(); // Call the method to fetch the resources |
463 | 515 | if (this.$route.query.snackbar) {
|
464 | 516 | this.createSnackbar(this.$route.query.snackbar);
|
465 | 517 | }
|
|
522 | 574 | nextRoute.name = nextRouteName;
|
523 | 575 | this.$router.push(nextRoute);
|
524 | 576 | },
|
| 577 | + fetchResources() { |
| 578 | + this.isLoading = true; |
| 579 | + ChannelResource.fetchCollection({ |
| 580 | + getParams: { |
| 581 | + contains_exercise: true, |
| 582 | + available: true, |
| 583 | + }, |
| 584 | + }).then(data => { |
| 585 | + this.channels = data; |
| 586 | + this.isLoading = false; |
| 587 | + }); |
| 588 | + }, |
525 | 589 | },
|
526 | 590 | $trs: {
|
527 | 591 | noExams: {
|
|
547 | 611 | context:
|
548 | 612 | "Title that displays on a printed copy of the 'Reports' > 'Lessons' page. This shows if the user uses the 'Print' option by clicking on the printer icon.",
|
549 | 613 | },
|
| 614 | + adminLink: { |
| 615 | + message: 'Import channels to your device', |
| 616 | + context: 'Message for admin indicating the possibility of importing channels into Kolibri.', |
| 617 | + }, |
550 | 618 | },
|
551 | 619 | };
|
552 | 620 |
|
|
577 | 645 | margin-bottom: 0.5em;
|
578 | 646 | }
|
579 | 647 |
|
| 648 | + .alert { |
| 649 | + position: relative; |
| 650 | + width: 100%; |
| 651 | + max-width: 1000px; |
| 652 | + padding: 0.5em; |
| 653 | + padding-left: 2em; |
| 654 | + margin: 1em auto 0; |
| 655 | + } |
| 656 | +
|
| 657 | + .warning-icon { |
| 658 | + position: absolute; |
| 659 | + top: 1em; |
| 660 | + left: 1em; |
| 661 | + width: 24px; |
| 662 | + height: 24px; |
| 663 | + } |
| 664 | +
|
| 665 | + .error-message { |
| 666 | + margin-left: 3em; |
| 667 | + font-size: 14px; |
| 668 | + } |
| 669 | +
|
| 670 | + .banner-spacing { |
| 671 | + margin: 0 0 1em; |
| 672 | + } |
| 673 | +
|
580 | 674 | </style>
|
0 commit comments