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 authored Aug 4, 2023
1 parent 0be039e commit 9323a3b
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 @@ -161,15 +161,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 @@ -213,6 +215,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 9323a3b

Please sign in to comment.