form validation
This commit is contained in:
parent
3a7045e958
commit
55dc023019
4 changed files with 16 additions and 14 deletions
|
@ -22,7 +22,7 @@
|
|||
v-btn(icon nuxt to='/export' v-on='on')
|
||||
v-icon mdi-share-variant
|
||||
|
||||
v-menu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length'
|
||||
//- v-menu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length'
|
||||
offset-y bottom open-on-hover transition="slide-y-transition")
|
||||
template(v-slot:activator="{ on, attrs }")
|
||||
v-btn(icon v-bind='attrs' v-on='on')
|
||||
|
|
|
@ -18,7 +18,7 @@ export default {
|
|||
data () {
|
||||
return {
|
||||
icon: 'md-alert',
|
||||
color: 'primary',
|
||||
color: 'secondary',
|
||||
bottom: true,
|
||||
top: false,
|
||||
left: false,
|
||||
|
@ -29,10 +29,10 @@ export default {
|
|||
}
|
||||
},
|
||||
created () {
|
||||
this.$root.$message = (message, opts) => {
|
||||
this.$root.$message = (message, opts = {}) => {
|
||||
this.active = true
|
||||
this.message = this.$t(message, opts)
|
||||
this.color = opts.color || 'primary'
|
||||
this.color = opts.color || 'secondary'
|
||||
this.icon = opts.icon || 'md-alert'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
v-card-title {{$t('common.announcements')}}
|
||||
v-card-subtitle(v-html="$t('admin.announcement_description')")
|
||||
v-dialog(v-model='dialog' width='800px')
|
||||
v-card
|
||||
v-card(color='secondary')
|
||||
v-card-title {{$t('admin.new_announcement')}}
|
||||
v-card-text
|
||||
v-form(v-model='valid' ref='announcement')
|
||||
v-text-field(v-model='announcement.title' :label='$t("common.title")')
|
||||
Editor.mt-2(v-model='announcement.announcement' border no-save style='max-height: 400px;')
|
||||
Editor.mt-2(v-model='announcement.announcement'
|
||||
border no-save max-height='400px' :placeholder="$t('common.description')")
|
||||
v-card-actions
|
||||
v-spacer
|
||||
v-btn(@click='dialog=false' color='error') {{$t('common.cancel')}}
|
||||
|
|
|
@ -41,19 +41,19 @@
|
|||
)
|
||||
|
||||
v-dialog(v-model='dialogAddInstance' width="500px")
|
||||
v-card
|
||||
v-card(color='secondary')
|
||||
v-card-title {{$t('admin.add_trusted_instance')}}
|
||||
v-card-text
|
||||
v-form(v-model='valid')
|
||||
v-text-field.mt-4(v-model='instance_url'
|
||||
persistent-hint
|
||||
:rules="[$validators.required()]"
|
||||
:hint="$t('admin.add_trusted_instance')"
|
||||
:label="$t('common.url')")
|
||||
v-form(v-model='valid' ref='form' lazy-validation)
|
||||
v-text-field.mt-4(v-model='instance_url'
|
||||
persistent-hint
|
||||
:rules="[$validators.required('common.url')]"
|
||||
:hint="$t('admin.add_trusted_instance')"
|
||||
:label="$t('common.url')")
|
||||
v-card-actions
|
||||
v-spacer
|
||||
v-btn(color='error' @click='dialogAddInstance=false') {{$t('common.cancel')}}
|
||||
v-btn(color='primary' @click='createTrustedInstance') {{$t('common.ok')}}
|
||||
v-btn(color='primary' :disabled='!valid' @click='createTrustedInstance') {{$t('common.ok')}}
|
||||
|
||||
v-btn.mt-4(@click='dialogAddInstance = true' color='primary' text) <v-icon>mdi-plus</v-icon> Add instance
|
||||
v-data-table(
|
||||
|
@ -112,6 +112,7 @@ export default {
|
|||
methods: {
|
||||
...mapActions(['setSetting']),
|
||||
async createTrustedInstance () {
|
||||
if (!this.$refs.form.validate()) return
|
||||
try {
|
||||
const instance = await axios.get(`${this.instance_url}/.well-known/nodeinfo/2.1`)
|
||||
this.setSetting({
|
||||
|
|
Loading…
Reference in a new issue