Skip to content

Commit

Permalink
Merge pull request #11835 from ozer550/quiz-creation-bookmark-selection
Browse files Browse the repository at this point in the history
Quiz creation bookmark selection
  • Loading branch information
ozer550 authored Feb 7, 2024
2 parents 107d834 + 986d6c4 commit d5c38df
Showing 1 changed file with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{ /* selectFoldersOrExercises$() */ }}
</h5>

<div v-if="!isTopicIdSet && bookmarks.length">
<div v-if="!isTopicIdSet && bookmarks.length && !showBookmarks">

<p>{{ selectFromBookmarks$() }}</p>

Expand Down Expand Up @@ -74,7 +74,7 @@
<KButton
:text="coreString('saveChangesAction')"
:primary="true"
:disabled="!hasTopicId()"
:disabled="!hasTopicId() && !showBookmarks"
@click="saveSelectedResource"
/>
</KGridItem>
Expand Down Expand Up @@ -113,6 +113,10 @@
const store = getCurrentInstance().proxy.$store;
const route = computed(() => store.state.route);
const topicId = computed(() => route.value.params.topic_id);
// We use this query parameter to decide if we want to show the Bookmarks Card
// or the actual exercises that are bookmarked and can be selected
// to be added to Quiz Section.
const showBookmarks = computed(() => route.value.query.showBookmarks);
const {
updateSection,
activeSection,
Expand Down Expand Up @@ -217,6 +221,12 @@
return channels.value;
}
*/
if (showBookmarks.value) {
return bookmarks.value
.filter(item => item.kind === 'exercise')
.map(item => ({ ...item, is_leaf: true }));
}
return resources.value;
});
Expand Down Expand Up @@ -256,6 +266,7 @@
workingResourcePool,
addToWorkingResourcePool,
removeFromWorkingResourcePool,
showBookmarks,
};
},
props: {
Expand Down Expand Up @@ -305,13 +316,13 @@
// console.log('Dynamic function called');
// };
},
getBookmarksLink() {
// Inject the showBookmarks parameter so that
// the resourceSelection component now renderes only the
// the exercises that are bookmarked for the Quiz selection.
return {
name: PageNames.BOOK_MARKED_RESOURCES,
params: {
section_id: this.$route.params.section_id,
},
name: PageNames.QUIZ_SELECT_RESOURCES,
query: { showBookmarks: true },
};
},
channelsLink() {
Expand All @@ -336,7 +347,9 @@
this.$refs.textbox.focus();
},
contentLink(content) {
if (!content.is_leaf) {
if (this.showBookmarks) {
return this.$route;
} else if (!content.is_leaf) {
return {
name: PageNames.QUIZ_SELECT_RESOURCES,
params: {
Expand Down Expand Up @@ -375,6 +388,7 @@
this.$route.query
);
},
topicsLink(topicId) {
return this.topicListingLink({ ...this.$route.params, topicId });
},
Expand Down

0 comments on commit d5c38df

Please sign in to comment.