Skip to content

Commit

Permalink
add showBookmarks query parameter in the route to decide the bookmark…
Browse files Browse the repository at this point in the history
…s rendering
  • Loading branch information
ozer550 committed Feb 6, 2024
1 parent 8f5c1ee commit 986d6c4
Showing 1 changed file with 13 additions and 7 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 && !bookMarksFlag">
<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() && !bookMarksFlag"
:disabled="!hasTopicId() && !showBookmarks"
@click="saveSelectedResource"
/>
</KGridItem>
Expand Down Expand Up @@ -113,7 +113,10 @@
const store = getCurrentInstance().proxy.$store;
const route = computed(() => store.state.route);
const topicId = computed(() => route.value.params.topic_id);
const bookMarksFlag = computed(() => route.value.query.bookmarks);
// 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 @@ -218,7 +221,7 @@
return channels.value;
}
*/
if (bookMarksFlag.value) {
if (showBookmarks.value) {
return bookmarks.value
.filter(item => item.kind === 'exercise')
.map(item => ({ ...item, is_leaf: true }));
Expand Down Expand Up @@ -263,7 +266,7 @@
workingResourcePool,
addToWorkingResourcePool,
removeFromWorkingResourcePool,
bookMarksFlag,
showBookmarks,
};
},
props: {
Expand Down Expand Up @@ -314,9 +317,12 @@
// };
},
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.QUIZ_SELECT_RESOURCES,
query: { bookmarks: true },
query: { showBookmarks: true },
};
},
channelsLink() {
Expand All @@ -341,7 +347,7 @@
this.$refs.textbox.focus();
},
contentLink(content) {
if (this.bookMarksFlag) {
if (this.showBookmarks) {
return this.$route;
} else if (!content.is_leaf) {
return {
Expand Down

0 comments on commit 986d6c4

Please sign in to comment.