1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<template>
<studip-dialog
:title="$gettext('Öffentlichen Link für Seite erzeugen')"
:confirmText="$gettext('Erstellen')"
confirmClass="accept"
:closeText="$gettext('Abbrechen')"
closeClass="cancel"
class="cw-structural-element-dialog"
@close="closePublicLinkDialog"
@confirm="createElementPublicLink"
>
<template v-slot:dialogContent>
<form class="default" @submit.prevent="">
<label>
{{ $gettext('Passwort') }}
<input type="password" v-model="publicLink.password" />
</label>
<label>
{{ $gettext('Ablaufdatum') }}
<datepicker v-model="publicLink['expire-date']" />
</label>
</form>
</template>
</studip-dialog>
</template>
<script>
import Datepicker from './../../Datepicker.vue';
import { mapActions } from 'vuex';
export default {
name: 'courseware-structural-element-dialog-public-link',
components: {
Datepicker,
},
props: {
structuralElement: Object,
},
data() {
return {
publicLink: {
passsword: '',
'expire-date': null
},
};
},
methods: {
...mapActions({
companionSuccess: 'companionSuccess',
createLink: 'createLink',
showElementPublicLinkDialog: 'showElementPublicLinkDialog',
}),
async createElementPublicLink() {
const date = this.publicLink['expire-date'];
const publicLink = {
attributes: {
password: this.publicLink.password,
'expire-date': date === null ? new Date(0).toISOString() : new Date(date * 1000).toISOString()
},
relationships: {
'structural-element': {
data: {
id: this.structuralElement.id,
type: 'courseware-structural-elements'
}
}
}
}
await this.createLink({ publicLink });
this.companionSuccess({
info: this.$gettext('Öffentlicher Link wurde angelegt. Unter „Freigaben“ finden Sie alle Ihre öffentlichen Links.'),
});
this.closePublicLinkDialog();
},
closePublicLinkDialog() {
this.publicLink = {
passsword: '',
'expire-date': ''
};
this.showElementPublicLinkDialog(false);
},
}
};
</script>
|