Hide form title via URL param (#89)

* Hide form title via URL param

* FormUrlPrefill smal fixes
This commit is contained in:
Chirag Chhatrala
2023-02-22 21:09:13 +05:30
committed by GitHub
parent b101a5daba
commit 47964ec565
8 changed files with 110 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div v-if="form" class="open-complete-form">
<h1 v-if="!form.hide_title" class="mb-4 px-2" v-text="form.title" />
<h1 v-if="!isHideTitle" class="mb-4 px-2" v-text="form.title" />
<div v-if="isPublicFormPage && form.is_password_protected">
<p class="form-description mb-4 text-gray-700 dark:text-gray-300 px-2">
@@ -177,6 +177,9 @@ export default {
},
isPublicFormPage () {
return this.$route.name === 'forms.show_public'
},
isHideTitle () {
return this.form.hide_title || window.location.href.includes('hide_title=true')
}
},

View File

@@ -0,0 +1,58 @@
<template>
<collapse class="py-5 w-full" :default-value="false">
<template #title>
<div class="flex">
<h3 class="font-semibold block text-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 inline text-gray-500 mr-2 -mt-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg> Show advanced options
</h3>
</div>
</template>
<toggle-switch-input :value="value.hide_title" name="hide_title" class="mt-4"
label="Hide Form Title"
:disabled="form.hide_title===true"
@input="onChangeHideTitle"
:help="hideTitleHelp"
/>
</collapse>
</template>
<script>
import Collapse from '../../../common/Collapse.vue'
export default {
name: 'AdvancedFormUrlSettings',
components: { Collapse },
props: {
form: {
type: Object,
required: true
},
value: {
type: Object,
required: true
}
},
data () {
return {
}
},
computed: {
hideTitleHelp () {
return this.form.hide_title ? 'This option is disabled because the form title is already hidden' : null
}
},
watch: {},
mounted () {},
methods: {
onChangeHideTitle (val) {
this.value.hide_title = val
}
}
}
</script>

View File

@@ -28,6 +28,10 @@ export default {
formData: {
type: Object,
required: true
},
extraQueryParam: {
type: String,
default: ''
}
},
@@ -51,7 +55,11 @@ export default {
}
})
return url + '?' + uriComponents
if(uriComponents.toString() !== ""){
return (this.extraQueryParam) ? url + '?' + uriComponents + '&' + this.extraQueryParam : url + '?' + uriComponents
}else{
return (this.extraQueryParam) ? url + '?' + this.extraQueryParam : url
}
}
},