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

Feature quiz section tabs with overflow #11382

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
2 changes: 1 addition & 1 deletion kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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#ab03c5e257a7806c67cf6250310e3e6ccb5119c9",
"kolibri-design-system": "https://github.com/learningequality/kolibri-design-system#50a07f361febc643505e8d6991b6a037d1432c63",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.8.1",
Expand Down
11 changes: 10 additions & 1 deletion kolibri/plugins/coach/assets/src/composables/useQuizCreation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { v4 as uuidv4 } from 'uuid';
import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings';
import uniq from 'lodash/uniq';
import { ContentNodeKinds } from 'kolibri.coreVue.vuex.constants';
import { ChannelResource, ExamResource } from 'kolibri.resources';
Expand Down Expand Up @@ -46,9 +47,12 @@ export default () => {
* The questions that are currently selected for action in the active section */
const _selectedQuestions = ref([]);

/** @type {ref<>} A list of all channels available which have exercises */
/** @type {ref<Array>} A list of all channels available which have exercises */
const _channels = ref([]);

/** @type {ref<Number>} A counter for use in naming new sections */
const _sectionLabelCounter = ref(1);

// ------------------
// Section Management
// ------------------
Expand Down Expand Up @@ -112,7 +116,11 @@ export default () => {
* Adds a section to the quiz and returns it */
function addSection() {
const newSection = objectWithDefaults({ section_id: uuidv4() }, QuizSection);
const { sectionLabel$ } = enhancedQuizManagementStrings;
newSection.section_title = `${sectionLabel$()} ${_sectionLabelCounter.value}`;
_sectionLabelCounter.value++;
updateQuiz({ question_sources: [...get(quiz).question_sources, newSection] });
setActiveSection(newSection.section_id);
return newSection;
}

Expand All @@ -127,6 +135,7 @@ export default () => {
if (updatedSections.length === 0) {
const newSection = addSection();
setActiveSection(newSection.section_id);
updatedSections.push(newSection);
} else {
setActiveSection(get(updatedSections)[0].section_id);
}
Expand Down
Loading
Loading