Skip to content

Commit

Permalink
Show delete Button in subtitle dialog an fix playlist video counter
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrahn committed Jun 26, 2023
1 parent 639ce20 commit 78efee4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
21 changes: 13 additions & 8 deletions vueapp/components/Videos/Actions/CaptionUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</a>
</label>

<label v-if="files[language.flavor] && files[language.flavor].url">
<label v-if="files[language.flavor]">
<StudipButton icon="trash" @click.prevent="removeCaption(language.flavor)">
{{ $gettext('Löschen') }}
</StudipButton>
Expand Down Expand Up @@ -157,15 +157,20 @@ export default {
}
}];
let view = this;
// get correct upload endpoint url
this.uploadService = new UploadService(this.selectedServer['apievents']);
if (this.files[flavor].url) {
let view = this;
// get correct upload endpoint url
this.uploadService = new UploadService(this.selectedServer['apievents']);
this.uploadService.uploadCaptions(files, this.event.episode, {
uploadProgress: () => {},
uploadDone: () => {
delete view.files[flavor]
this.uploadService.uploadCaptions(files, this.event.episode, {
uploadProgress: () => {},
uploadDone: () => {
delete view.files[flavor]
}})
} else {
delete this.files[flavor]
}
}
},
Expand Down
7 changes: 7 additions & 0 deletions vueapp/store/playlists.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ const actions = {
for (let i = 0; i < data.videos.length; i++) {
await ApiService.put('/playlists/' + data.playlist + '/video/' + data.videos[i]);
}
context.commit('addToVideosCount', {'token': data.playlist, 'addToCount': data.videos.length});
},

async removeVideosFromPlaylist(context, data) {
for (let i = 0; i < data.videos.length; i++) {
await ApiService.delete('/playlists/' + data.playlist + '/video/' + data.videos[i]);
}
context.commit('addToVideosCount', {'token': data.playlist, 'addToCount': -data.videos.length});
},

addPlaylistUI({ commit }, show) {
Expand Down Expand Up @@ -206,6 +208,11 @@ const mutations = {

setAllowDownload(state, allowed) {
state.playlist.allow_download = allowed;
},

addToVideosCount(state, data) {
let idx = state.playlists.findIndex(playlist => playlist.token === data.token);
state.playlists[idx].videos_count += data.addToCount;
}
}

Expand Down

0 comments on commit 78efee4

Please sign in to comment.