From 274ba2f0cb81c8eebf4faea626cf72fb245bfd39 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Tue, 31 Oct 2023 08:51:58 -0700 Subject: [PATCH 01/21] set not loading when quiz creator comes up --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 41aadf022c3..7b572012515 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -108,6 +108,9 @@ created() { this.quizForge.initializeQuiz(); }, + mounted() { + this.$store.dispatch('notLoading'); + }, $trs: { createNewExamLabel: { message: 'Create new quiz', From b02fdb34823e09a46f39bbbbf9423a15115cd210 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Thu, 12 Oct 2023 15:44:31 -0700 Subject: [PATCH 02/21] add DEBUG option to useQuizCreation; bootstrap basic accordion setup --- .../assets/src/composables/useQuizCreation.js | 44 ++++++++++-- .../plan/CreateExamPage/AccordionItem.vue | 2 +- .../plan/CreateExamPage/CreateQuizSection.vue | 67 ++++++++++++++----- .../src/views/plan/CreateExamPage/index.vue | 15 +++-- 4 files changed, 100 insertions(+), 28 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index 67e547dc9a3..64b6ff280f4 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -8,7 +8,7 @@ import { get, set } from '@vueuse/core'; import { computed, ref } from 'kolibri.lib.vueCompositionApi'; // TODO: Probably move this to this file's local dir import selectQuestions from '../modules/examCreation/selectQuestions.js'; -import { Quiz, QuizSection } from './quizCreationSpecs.js'; +import { Quiz, QuizSection, QuizQuestion } from './quizCreationSpecs.js'; /** Validators **/ /* objectSpecs expects every property to be available -- but we don't want to have to make an @@ -30,7 +30,7 @@ function isExercise(o) { /** * Composable function presenting primary interface for Quiz Creation */ -export default () => { +export default (DEBUG = true) => { // ----------- // Local state // ----------- @@ -53,6 +53,38 @@ export default () => { /** @type {ref} A counter for use in naming new sections */ const _sectionLabelCounter = ref(1); + // Debug Data Generators + function _quizQuestions(num = 5) { + const questions = []; + for (let i = 0; i <= num; i++) { + const overrides = { + title: `Quiz Question ${i}`, + question_id: `${i}`, + }; + questions.push(objectWithDefaults(overrides, QuizQuestion)); + } + return questions; + } + + function _quizSections(num = 5, numQuestions = 5) { + const sections = []; + for (let i = 0; i <= num; i++) { + const overrides = { + section_id: `${i}`, + section_title: `A section ${i}`, + questions: _quizQuestions(numQuestions), + }; + sections.push(objectWithDefaults(overrides, QuizSection)); + } + return sections; + } + + function _generateTestData(numSections = 5, numQuestions = 5) { + const sections = _quizSections(numSections, numQuestions); + updateQuiz({ question_sources: sections }); + setActiveSection(sections[0].section_id); + } + // ------------------ // Section Management // ------------------ @@ -162,8 +194,12 @@ export default () => { * use */ function initializeQuiz() { set(_quiz, objectWithDefaults({}, Quiz)); - const newSection = addSection(); - setActiveSection(newSection.section_id); + if (DEBUG) { + _generateTestData(); + } else { + const newSection = addSection(); + setActiveSection(newSection.section_id); + } _fetchChannels(); } diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/AccordionItem.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/AccordionItem.vue index f0d32869a5c..27e61bc3ad9 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/AccordionItem.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/AccordionItem.vue @@ -32,7 +32,7 @@ required: true, }, id: { - type: Number, + type: String, required: true, }, }, diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 6f9dc0adbb4..8abe3f331c6 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -153,28 +153,51 @@ tabsId="quizSectionTabs" :activeTabId="quizForge.activeSection.value ? quizForge.activeSection.value.section_id : ''" > - -

{{ quizForge.activeSection.value.section_id }}

-
- ? -
+
+
+ ? +
-

- {{ noQuestionsInSection$() }} -

+

+ {{ noQuestionsInSection$() }} +

-

{{ addQuizSectionQuestionsInstructions$() }}

+

{{ addQuizSectionQuestionsInstructions$() }}

- - {{ addQuestionsLabel$() }} - + + {{ addQuestionsLabel$() }} + +
+ + + + @@ -191,12 +214,16 @@ import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; import commonCoach from '../../common'; - import SectionSidePanel from './SectionSidePanel.vue'; - import TabsWithOverflow from './TabsWithOverflow.vue'; + import SectionSidePanel from './SectionSidePanel'; + import TabsWithOverflow from './TabsWithOverflow'; + import AccordionContainer from './AccordionContainer'; + import AccordionItem from './AccordionItem'; export default { name: 'CreateQuizSection', components: { + AccordionContainer, + AccordionItem, TabsWithOverflow, SectionSidePanel, }, @@ -264,6 +291,10 @@ }, ]; }, + accordionQuestions() { + const mapQuestionToAccordionItem = q => ({ id: q.question_id, title: q.title }); + return get(this.quizForge.activeQuestions).map(mapQuestionToAccordionItem); + }, }, methods: { tabRefLabel(section_id) { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 7b572012515..fba6c77f1c5 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -20,7 +20,7 @@ :style="{ ...maxContainerHeight, maxWidth: '1000px', margin: '0 auto' }" > - + @@ -41,6 +41,8 @@ diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 296bbb08e1d..c3b0a009a90 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -10,6 +10,10 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag createNewQuiz: { message: 'Create new quiz', }, + quizSectionsLabel: { + message: 'Quiz sections', + context: 'Used as an aria-label for screen readers to describe the purpose of the list of tabs', + }, quizTitle: { message: 'Quiz title', }, From f166476bb9f2069b51c001e6d4d1a0992b9d8b36 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 25 Oct 2023 22:04:37 -0700 Subject: [PATCH 16/21] handle quiz title field --- .../assets/src/views/plan/CreateExamPage/CreateQuizSection.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 25bb10830b5..ad0b77be762 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -24,6 +24,7 @@ :autofocus="true" :maxlength="100" @blur="e => quizForge.updateQuiz({ title: e.target.value })" + @change="title => quizForge.updateQuiz({ title })" /> From 1b08d9cff430b3498e2baa04fb4914c022a55c71 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 15 Nov 2023 17:54:35 -0800 Subject: [PATCH 17/21] Ensure [Tab]-nav flow works properly when leaving Options button KDS commit 047379f579ad7067381a9576edc21abd12ad8378 is a req for this change --- .../assets/src/views/plan/CreateExamPage/CreateQuizSection.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index ad0b77be762..0f21e573849 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -154,6 +154,7 @@ :disabled="false" :hasIcons="true" :options="activeSectionActions" + @tab="e => (e.preventDefault() || $refs.selectAllCheckbox.focus())" @select="handleActiveSectionAction" /> @@ -161,7 +162,6 @@ - Date: Wed, 15 Nov 2023 18:13:55 -0800 Subject: [PATCH 18/21] not debug by default --- kolibri/plugins/coach/assets/src/composables/useQuizCreation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index 923fadeff1e..db10418e6af 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -31,7 +31,7 @@ function isExercise(o) { /** * Composable function presenting primary interface for Quiz Creation */ -export default (DEBUG = true) => { +export default (DEBUG = false) => { // ----------- // Local state // ----------- From a86be796e480ba3dad7cbc9615c151b3c0862295 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Thu, 16 Nov 2023 15:09:41 -0800 Subject: [PATCH 19/21] fix eternal loading state when navigation routes --- .../plan/CreateExamPage/CreateQuizSection.vue | 28 +++++++++++++++---- .../src/views/plan/CreateExamPage/index.vue | 4 +++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 0f21e573849..e7b78407e30 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -109,6 +109,28 @@ >
+ + + + + + +
?
@@ -439,9 +461,6 @@ ]; }, }, - mounted() { - this.$store.dispatch('notLoading'); - }, methods: { handleReplaceSelection() { const section_id = get(this.quizForge.activeSection).section_id; @@ -454,7 +473,6 @@ this.$router.replace({ path: 'new/' + section_id + '/edit' }); break; case this.deleteSectionLabel$(): - console.log('Deleting, ', this.quizForge.activeSection.value.section_id); this.quizForge.removeSection(this.quizForge.activeSection.value.section_id); this.focusActiveSectionTab(); break; @@ -698,7 +716,7 @@ } /deep/ .overflow-tabs svg { - top: 7px !important; + top: 5px !important; } .select-all-box { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index fba6c77f1c5..0ed911db4a6 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -103,6 +103,10 @@ }, }, watch: { + $route: function() { + // FIXME Coach shouldn't be setting loading in a beforeEach here maybe? + this.$store.dispatch('notLoading'); + }, filters(newVal) { this.$router.push({ query: { ...this.$route.query, ...pickBy(newVal) }, From 51d0e6a7adebc2bb1f54b3000006fea585f3161d Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Wed, 29 Nov 2023 13:19:09 -0800 Subject: [PATCH 20/21] KDS Update --- kolibri/core/package.json | 2 +- yarn.lock | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/kolibri/core/package.json b/kolibri/core/package.json index fa362410689..b237aa97759 100644 --- a/kolibri/core/package.json +++ b/kolibri/core/package.json @@ -21,7 +21,7 @@ "js-cookie": "^3.0.5", "knuth-shuffle-seeded": "^1.0.6", "kolibri-constants": "0.2.0", - "kolibri-design-system": "https://github.com/learningequality/kolibri-design-system#v2.0.0-beta1", + "kolibri-design-system": "https://github.com/learningequality/kolibri-design-system#0ed2f274b1bc3808218a4d3f526c181b96b32c6d", "lockr": "0.8.5", "lodash": "^4.17.21", "loglevel": "^1.8.1", diff --git a/yarn.lock b/yarn.lock index 83628e74102..154d12265f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7648,6 +7648,22 @@ kolibri-constants@0.2.0: resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.2.0.tgz#47c9d773894e23251ba5ac4db420822e45603142" integrity sha512-WYDMGDzB9gNxRbpX1O2cGe1HrJvLvSZGwMuAv6dqrxJgPf7iO+Hi40/1CXjHM7nk5CRt+hn5bqnMzCBmj1omPA== +"kolibri-design-system@https://github.com/learningequality/kolibri-design-system#0ed2f274b1bc3808218a4d3f526c181b96b32c6d": + version "1.3.0" + resolved "https://github.com/learningequality/kolibri-design-system#0ed2f274b1bc3808218a4d3f526c181b96b32c6d" + dependencies: + aphrodite "https://github.com/learningequality/aphrodite/" + autosize "^3.0.21" + css-element-queries "^1.2.0" + frame-throttle "^3.0.0" + fuzzysearch "^1.0.3" + keen-ui "^1.3.0" + lodash "^4.17.15" + popper.js "^1.14.6" + purecss "^0.6.2" + tippy.js "^4.2.1" + vue-intl "^3.1.0" + "kolibri-design-system@https://github.com/learningequality/kolibri-design-system#v2.0.0-beta1": version "1.3.0" resolved "https://github.com/learningequality/kolibri-design-system#13e539592fd87508cd32f60e4ad22c1ec320559b" From 1a65873c674ba71def0a681e6d61ef3dc78da543 Mon Sep 17 00:00:00 2001 From: Jacob Pierce Date: Thu, 30 Nov 2023 13:17:19 -0800 Subject: [PATCH 21/21] lint --- kolibri/plugins/coach/assets/src/composables/useQuizCreation.js | 1 - 1 file changed, 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index db10418e6af..41aa7b3bcea 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -99,7 +99,6 @@ export default (DEBUG = false) => { * @throws {TypeError} if section is not a valid QuizSection **/ function updateSection({ section_id, ...updates }) { - console.log('updating with...', section_id, updates); const targetSection = get(allSections).find(section => section.section_id === section_id); if (!targetSection) { throw new TypeError(`Section with id ${section_id} not found; cannot be updated.`);