2018-09-03 16:23:50 +02:00
|
|
|
<template>
|
2018-11-02 15:05:53 +01:00
|
|
|
<div>
|
|
|
|
<ui-card>
|
|
|
|
<div slot="title">%i18n:@announcements%</div>
|
|
|
|
<section>
|
|
|
|
<textarea class="qldxjjsrseehkusjuoooapmsprvfrxyl" v-model="broadcasts" placeholder='[ { "title": "Title1", "text": "Text1" }, { "title": "Title2", "text": "Text2" } ]'></textarea>
|
|
|
|
<ui-button @click="save">%i18n:@save%</ui-button>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
2018-09-03 16:23:50 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from "vue";
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
broadcasts: '',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
(this as any).os.getMeta().then(meta => {
|
|
|
|
this.broadcasts = JSON.stringify(meta.broadcasts, null, ' ');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
save() {
|
2018-10-02 16:42:46 +02:00
|
|
|
let json;
|
|
|
|
|
|
|
|
try {
|
|
|
|
json = JSON.parse(this.broadcasts);
|
|
|
|
} catch (e) {
|
|
|
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-09-03 16:23:50 +02:00
|
|
|
(this as any).api('admin/update-meta', {
|
2018-10-02 16:42:46 +02:00
|
|
|
broadcasts: json
|
|
|
|
}).then(() => {
|
|
|
|
(this as any).os.apis.dialog({ text: `Saved` });
|
|
|
|
}.catch(e => {
|
|
|
|
(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
2018-09-03 16:23:50 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.qldxjjsrseehkusjuoooapmsprvfrxyl
|
2018-11-02 15:05:53 +01:00
|
|
|
width 100%
|
|
|
|
min-height 300px
|
2018-09-03 16:23:50 +02:00
|
|
|
|
|
|
|
</style>
|