Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show delete Button in subtitle dialog an fix playlist video counter #736

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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