Refactor filtering on activity pages
This commit is contained in:
parent
6d5e66c469
commit
5aaa854918
|
|
@ -4,14 +4,12 @@
|
||||||
<h2 class="instrument-activity__title">{{instrument.title}}</h2>
|
<h2 class="instrument-activity__title">{{instrument.title}}</h2>
|
||||||
<div class="instrument-activity__tasks activity-tasks">
|
<div class="instrument-activity__tasks activity-tasks">
|
||||||
<activity-entry title="Lesezeichen" class="instrument-activity__entry"
|
<activity-entry title="Lesezeichen" class="instrument-activity__entry"
|
||||||
v-for="bookmark in instrument.bookmarks"
|
v-for="bookmark in bookmarks"
|
||||||
:key="bookmark.id"
|
:key="bookmark.id"
|
||||||
v-if="applyFilter('bookmarks')"
|
|
||||||
@link="goTo(bookmark.uuid)">
|
@link="goTo(bookmark.uuid)">
|
||||||
<content-bookmark :bookmark="bookmark"></content-bookmark>
|
<content-bookmark :bookmark="bookmark"></content-bookmark>
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry title="Notiz" class="instrument-activity__entry"
|
<activity-entry title="Notiz" class="instrument-activity__entry"
|
||||||
v-if="applyFilter('notes')"
|
|
||||||
v-for="note in notes"
|
v-for="note in notes"
|
||||||
:key="note.id"
|
:key="note.id"
|
||||||
@link="goTo(note.id)">
|
@link="goTo(note.id)">
|
||||||
|
|
@ -40,9 +38,12 @@
|
||||||
return !this.instrument.bookmarks.length
|
return !this.instrument.bookmarks.length
|
||||||
},
|
},
|
||||||
notes() {
|
notes() {
|
||||||
return this.instrument.bookmarks
|
return this.applyFilter('notes') ? this.instrument.bookmarks
|
||||||
.filter(b => b.note)
|
.filter(b => b.note)
|
||||||
.map(b => b.note);
|
.map(b => b.note) : [];
|
||||||
|
},
|
||||||
|
bookmarks() {
|
||||||
|
return this.applyFilter('bookmarks') ? this.instrument.bookmarks : [];
|
||||||
},
|
},
|
||||||
type() {
|
type() {
|
||||||
if (this.instrument.type === 'LANGUAGE_COMMUNICATION') {
|
if (this.instrument.type === 'LANGUAGE_COMMUNICATION') {
|
||||||
|
|
|
||||||
|
|
@ -4,35 +4,31 @@
|
||||||
<h2 class="module-activity__title">{{module.metaTitle}} - {{module.title}}</h2>
|
<h2 class="module-activity__title">{{module.metaTitle}} - {{module.title}}</h2>
|
||||||
<div class="module-activity__tasks activity-tasks">
|
<div class="module-activity__tasks activity-tasks">
|
||||||
<activity-entry title="Aufgabe & Ergebnis" class="module-activity__entry"
|
<activity-entry title="Aufgabe & Ergebnis" class="module-activity__entry"
|
||||||
v-for="submission in module.mySubmissions"
|
v-for="submission in submissions"
|
||||||
:key="submission.id"
|
:key="submission.id"
|
||||||
v-if="applyFilter('assignments')"
|
|
||||||
@link="goTo(submission.assignment.id)">
|
@link="goTo(submission.assignment.id)">
|
||||||
{{submission.text}}
|
{{submission.text}}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry title="Übung" class="module-activity__entry"
|
<activity-entry title="Übung" class="module-activity__entry"
|
||||||
v-for="answer in module.myAnswers"
|
v-for="answer in answers"
|
||||||
v-if="applyFilter('surveys')"
|
|
||||||
:key="answer.id"
|
:key="answer.id"
|
||||||
@link="goTo(answer.survey.id)">
|
@link="goTo(answer.survey.id)">
|
||||||
{{answer.survey.title}}
|
{{answer.survey.title}}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry title="Lesezeichen" class="module-activity__entry"
|
<activity-entry title="Lesezeichen" class="module-activity__entry"
|
||||||
v-for="bookmark in module.myContentBookmarks"
|
v-for="bookmark in contentBookmarks"
|
||||||
:key="bookmark.id"
|
:key="bookmark.id"
|
||||||
v-if="applyFilter('bookmarks')"
|
|
||||||
@link="goTo(bookmark.uuid)">
|
@link="goTo(bookmark.uuid)">
|
||||||
<content-bookmark :bookmark="bookmark"></content-bookmark>
|
<content-bookmark :bookmark="bookmark"></content-bookmark>
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry title="Lesezeichen" class="module-activity__entry"
|
<activity-entry title="Lesezeichen" class="module-activity__entry"
|
||||||
v-for="bookmark in module.myChapterBookmarks"
|
v-for="bookmark in chapterBookmarks"
|
||||||
v-if="applyFilter('bookmarks')"
|
|
||||||
:key="bookmark.id"
|
:key="bookmark.id"
|
||||||
@link="goTo(bookmark.chapter.id)">
|
@link="goTo(bookmark.chapter.id)">
|
||||||
{{bookmark.chapter.description}}
|
{{bookmark.chapter.description}}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry title="Notiz" class="module-activity__entry"
|
<activity-entry title="Notiz" class="module-activity__entry"
|
||||||
v-if="applyFilter('notes')"
|
|
||||||
v-for="note in notes" :key="note.id"
|
v-for="note in notes" :key="note.id"
|
||||||
@link="goTo(note.id)">
|
@link="goTo(note.id)">
|
||||||
{{note.text}}
|
{{note.text}}
|
||||||
|
|
@ -64,11 +60,23 @@
|
||||||
this.module.bookmark)
|
this.module.bookmark)
|
||||||
},
|
},
|
||||||
notes() {
|
notes() {
|
||||||
return this.module.myChapterBookmarks
|
return this.applyFilter('notes') ? this.module.myChapterBookmarks
|
||||||
.concat(this.module.myContentBookmarks)
|
.concat(this.module.myContentBookmarks)
|
||||||
.concat([this.module.bookmark ? this.module.bookmark : {}])
|
.concat([this.module.bookmark ? this.module.bookmark : {}])
|
||||||
.filter(b => b.note)
|
.filter(b => b.note)
|
||||||
.map(b => b.note);
|
.map(b => b.note) : [];
|
||||||
|
},
|
||||||
|
submissions() {
|
||||||
|
return this.applyFilter('assignments') ? this.module.mySubmissions : [];
|
||||||
|
},
|
||||||
|
answers() {
|
||||||
|
return this.applyFilter('surveys') ? this.module.myAnswers : [];
|
||||||
|
},
|
||||||
|
contentBookmarks() {
|
||||||
|
return this.applyFilter('bookmarks') ? this.module.myContentBookmarks : [];
|
||||||
|
},
|
||||||
|
chapterBookmarks() {
|
||||||
|
return this.applyFilter('bookmarks') ? this.module.myChapterBookmarks : [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue