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