Skip to content

Commit

Permalink
Show tooltip with linked courses in link video dialog, ref elan-ev#794
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Benz committed Dec 20, 2023
1 parent 094d3a1 commit e73bde9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Models/Playlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ public function toSanitizedArray()

$data['tags'] = $this->tags->toArray();

$data['courses'] = [];
if (!empty($this->courses)) {
$data['courses'] = PlaylistSeminars::getCoursesArray(
$this->courses->map(function ($course) {
return $course->id;
})
);
}

if (!is_null($data['allow_download'])) {
$data['allow_download'] = filter_var(
$data['allow_download'],
Expand Down
26 changes: 26 additions & 0 deletions vueapp/components/Videos/Actions/VideoLinkToPlaylists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
>
<template v-slot:dialogContent>
<table class="default" v-if="event.playlists.length > 0">
<colgroup>
<col>
<col style="width: 32px">
<col style="width: 32px">
</colgroup>
<thead>
<tr>
<th>
{{ $gettext('Wiedergabeliste') }}
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
Expand All @@ -25,6 +31,12 @@
{{ playlist.title }}
</router-link>
</td>
<td>
<div data-tooltip class="tooltip" v-if="getPlaylistInfo(playlist)">
<span class="tooltip-content" v-html="getPlaylistInfo(playlist)"></span>
<studip-icon shape="info-circle" role="active" :size="18" />
</div>
</td>
<td>
<studip-icon shape="trash" role="clickable" @click="removePlaylist(index)" style="cursor: pointer"/>
</td>
Expand Down Expand Up @@ -83,6 +95,20 @@ export default {
},
methods: {
getPlaylistInfo(playlist) {
let info = '';
if (playlist.courses) {
info += '<div>' + this.$gettext('Verknüpfte Kurse') + '<ul>';
for (const course of playlist.courses) {
info += '<li>' + course.name + '</li>';
}
info += '</ul></div>';
}
return info;
},
addPlaylist(playlist) {
this.event.playlists.push(playlist);
Expand Down

0 comments on commit e73bde9

Please sign in to comment.