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

Quiz creation bookmark selection #11835

Merged
Merged
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
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
Loading