Sha256: 2199adcfb6c82f8155b9fc3e12e93512e4a0b046f211b63b2b018bb920194b06
Contents?: true
Size: 1.83 KB
Versions: 13
Compression:
Stored size: 1.83 KB
Contents
<template> <div class="flex flex-col flex-1 overflow-y-hidden"> <tabs :tabs="tabs" :otherProps="{ page, errors }" sharedClass="px-1/2" class="overflow-y-hidden pb-4" @on-change="onChange" /> <div class="mt-auto"> <submit-button type="button" class="big-submit-button" defaultColorClass="bg-editor-primary" :labels="$t('page.new.submitButton')" :buttonState="submitState" @click="createPage" > {{ $t('page.new.submitButton') }} </submit-button> <button class="cancel-button" @click="$emit('on-close')"> {{ $t('page.new.cancelButton') }} </button> </div> </div> </template> <script> import MainForm from './form/main.vue' import SEOForm from './form/seo.vue' export default { name: 'NewPage', data() { return { page: {}, errors: {}, submitState: 'default' } }, mounted() { this.page = this.services.page.build() }, computed: { tabs() { return [ { name: this.$t('page.form.tabs.main'), tab: MainForm, type: 'main', }, { name: this.$t('page.form.tabs.seo'), tab: SEOForm, type: 'seo', }, ] }, }, methods: { createPage() { this.submitState = 'inProgress' this.services.page .create(this.page) .then(() => { this.submitState = 'success' this.$emit('on-close') this.$emit('on-refresh') }) .catch(({ response: { status, data } }) => { console.log('[Maglev] could not create the page', status) this.submitState = 'fail' if (status !== 400) return this.errors = data.errors }) }, onChange(changes) { this.page = { ...this.page, ...changes } }, }, } </script>
Version data entries
13 entries across 13 versions & 1 rubygems