Alert for Draft Form (#180)
* Enable Pro plan - WIP * no pricing page if have no paid plans * Set pricing ids in env * views & submissions FREE for all * extra param for env * form password FREE for all * Custom Code is PRO feature * Replace codeinput prism with codemirror * Better form Cleaning message * Added risky user email spam protection * fix form cleaning * Custom SEO * fix custom seo formcleaner * Better webhooks * Slack-Discord extra feature * Alert for Draft Form/View
This commit is contained in:
parent
662088e20f
commit
c0a8f0d2bd
|
@ -98,7 +98,7 @@ class FormController extends Controller
|
||||||
]));
|
]));
|
||||||
|
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'message' => $this->formCleaner->hasCleaned() ? 'Form successfully created, but the Pro features you used will be disabled when sharing your form:' : 'Form created.',
|
'message' => $this->formCleaner->hasCleaned() ? 'Form successfully created, but the Pro features you used will be disabled when sharing your form:' : 'Form created.' . ($form->visibility == 'draft' ? ' But other people won\'t be able to see the form since it\'s currently in draft mode' : ''),
|
||||||
'form' => (new FormResource($form))->setCleanings($this->formCleaner->getPerformedCleanings()),
|
'form' => (new FormResource($form))->setCleanings($this->formCleaner->getPerformedCleanings()),
|
||||||
'users_first_form' => $request->user()->forms()->count() == 1
|
'users_first_form' => $request->user()->forms()->count() == 1
|
||||||
]);
|
]);
|
||||||
|
@ -122,7 +122,7 @@ class FormController extends Controller
|
||||||
$form->update($formData);
|
$form->update($formData);
|
||||||
|
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'message' => $this->formCleaner->hasCleaned() ? 'Form successfully updated, but the Pro features you used will be disabled when sharing your form:' : 'Form updated.',
|
'message' => $this->formCleaner->hasCleaned() ? 'Form successfully updated, but the Pro features you used will be disabled when sharing your form:' : 'Form updated.' . ($form->visibility == 'draft' ? ' But other people won\'t be able to see the form since it\'s currently in draft mode' : ''),
|
||||||
'form' => (new FormResource($form))->setCleanings($this->formCleaner->getPerformedCleanings()),
|
'form' => (new FormResource($form))->setCleanings($this->formCleaner->getPerformedCleanings()),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,10 @@ class Form extends Model
|
||||||
|
|
||||||
// Security & Privacy
|
// Security & Privacy
|
||||||
'can_be_indexed',
|
'can_be_indexed',
|
||||||
'password'
|
'password',
|
||||||
|
|
||||||
|
// Custom SEO
|
||||||
|
'seo_meta'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|
|
@ -29,6 +29,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
isDraft: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -50,7 +54,8 @@ export default {
|
||||||
el.select()
|
el.select()
|
||||||
document.execCommand('copy')
|
document.execCommand('copy')
|
||||||
document.body.removeChild(el)
|
document.body.removeChild(el)
|
||||||
this.alertSuccess('Copied!')
|
this.alertSuccess((this.isDraft) ? 'Copied! But other people won\'t be able to see the form since it\'s currently in draft mode' : 'Copied!')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<h3 class="font-semibold text-xl">Share Link</h3>
|
<h3 class="font-semibold text-xl">Share Link</h3>
|
||||||
<p>Your form is now published and ready to be shared with the world! Copy this link to share your form
|
<p>Your form is now published and ready to be shared with the world! Copy this link to share your form
|
||||||
on social media, messaging apps or via email.</p>
|
on social media, messaging apps or via email.</p>
|
||||||
<copy-content :content="share_url">
|
<copy-content :content="share_url" :is-draft="form.visibility=='draft'">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<svg class="h-4 w-4 -mt-1 text-blue-600 inline mr-1" viewBox="0 0 20 10" fill="none"
|
<svg class="h-4 w-4 -mt-1 text-blue-600 inline mr-1" viewBox="0 0 20 10" fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
displayFormModificationAlert (responseData) {
|
displayFormModificationAlert (responseData) {
|
||||||
if (responseData.form.cleanings && Object.keys(responseData.form.cleanings).length > 0) {
|
if (responseData.form && responseData.form.cleanings && Object.keys(responseData.form.cleanings).length > 0) {
|
||||||
this.alertWarning(responseData.message)
|
this.alertWarning(responseData.message)
|
||||||
} else {
|
} else {
|
||||||
this.alertSuccess(responseData.message)
|
this.alertSuccess(responseData.message)
|
||||||
|
|
|
@ -49,10 +49,20 @@
|
||||||
<span class="pr-1">- {{ form.submissions_count }}
|
<span class="pr-1">- {{ form.submissions_count }}
|
||||||
submission{{ form.submissions_count > 0 ? 's' : '' }}
|
submission{{ form.submissions_count > 0 ? 's' : '' }}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-blue-500" v-if="form.visibility=='draft'">- Draft (not public)</span>
|
|
||||||
<span class="pr-1 text-blue-500" v-if="form.visibility=='closed'">- Closed</span>
|
<span class="pr-1 text-blue-500" v-if="form.visibility=='closed'">- Closed</span>
|
||||||
<span class="">- Edited {{ form.last_edited_human }}</span>
|
<span class="">- Edited {{ form.last_edited_human }}</span>
|
||||||
</p>
|
</p>
|
||||||
|
<div v-if="form.visibility=='draft' || (form.tags && form.tags.length > 0)" class="mt-2 flex items-center flex-wrap gap-3">
|
||||||
|
<span v-if="form.visibility=='draft'"
|
||||||
|
class="inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-600 ring-1 ring-inset ring-gray-500/10 dark:text-white dark:bg-gray-700">
|
||||||
|
Draft - not publicly accessible
|
||||||
|
</span>
|
||||||
|
<span v-for="(tag,i) in form.tags" :key="tag"
|
||||||
|
class="inline-flex items-center rounded-full bg-gray-50 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10 dark:text-white dark:bg-gray-700"
|
||||||
|
>
|
||||||
|
{{ tag }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p v-if="form.closes_at" class="text-yellow-500">
|
<p v-if="form.closes_at" class="text-yellow-500">
|
||||||
<span v-if="form.is_closed"> This form stopped accepting submissions on the {{
|
<span v-if="form.is_closed"> This form stopped accepting submissions on the {{
|
||||||
|
|
|
@ -24,11 +24,15 @@
|
||||||
<text-input v-if="forms.length > 0" class="mb-6" :form="searchForm" name="search" label="Search a form"
|
<text-input v-if="forms.length > 0" class="mb-6" :form="searchForm" name="search" label="Search a form"
|
||||||
placeholder="Name of form to search"
|
placeholder="Name of form to search"
|
||||||
/>
|
/>
|
||||||
<div v-if="allTags.length > 0" class="mb-6">
|
<div v-if="allTags.length > 0" class="mb-4">
|
||||||
<div v-for="tag in allTags" :key="tag"
|
<div v-for="tag in allTags" :key="tag"
|
||||||
:class="['text-white p-2 text-xs inline rounded-lg font-semibold cursor-pointer mr-2',{'bg-gray-500 dark:bg-gray-400':selectedTags.includes(tag), 'bg-gray-300 dark:bg-gray-700':!selectedTags.includes(tag)}]"
|
:class="[
|
||||||
title="Click for filter by tag(s)"
|
'inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset cursor-pointer mr-2',
|
||||||
@click="onTagClick(tag)"
|
{'bg-blue-50 text-blue-600 ring-blue-500/10 dark:bg-blue-400':selectedTags.includes(tag),
|
||||||
|
'bg-gray-50 text-gray-600 ring-gray-500/10 dark:bg-gray-700 hover:bg-blue-50 hover:text-blue-600 hover:ring-blue-500/10 hover:dark:bg-blue-400':!selectedTags.includes(tag)}
|
||||||
|
]"
|
||||||
|
title="Click for filter by tag(s)"
|
||||||
|
@click="onTagClick(tag)"
|
||||||
>
|
>
|
||||||
{{ tag }}
|
{{ tag }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,22 +63,18 @@
|
||||||
<li class="list-disc ml-6 pr-1">{{ form.submissions_count }}
|
<li class="list-disc ml-6 pr-1">{{ form.submissions_count }}
|
||||||
submission{{ form.submissions_count > 0 ? 's' : '' }}
|
submission{{ form.submissions_count > 0 ? 's' : '' }}
|
||||||
</li>
|
</li>
|
||||||
<li class="list-disc ml-6 pr-1 text-blue-500" v-if="form.visibility=='draft'">Draft (not public)</li>
|
|
||||||
<li class="list-disc ml-6">Edited {{ form.last_edited_human }}</li>
|
<li class="list-disc ml-6">Edited {{ form.last_edited_human }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-if="form.tags && form.tags.length > 0" class="mt-1">
|
<div v-if="form.visibility=='draft' || (form.tags && form.tags.length > 0)" class="mt-1 flex items-center flex-wrap gap-3">
|
||||||
<template v-for="(tag,i) in form.tags">
|
<span v-if="form.visibility=='draft'"
|
||||||
<div v-if="i<1" :key="tag"
|
class="inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-600 ring-1 ring-inset ring-gray-500/10 dark:text-white dark:bg-gray-700">
|
||||||
class="bg-gray-300 dark:bg-gray-700 text-white px-2 py-1 mr-2 text-xs inline rounded-lg font-semibold"
|
Draft
|
||||||
>
|
</span>
|
||||||
{{ tag }}
|
<span v-for="(tag,i) in form.tags" :key="tag"
|
||||||
</div>
|
class="inline-flex items-center rounded-full bg-gray-50 px-2 py-1 text-xs font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10 dark:text-white dark:bg-gray-700"
|
||||||
<div v-if="i==1" :key="tag"
|
>
|
||||||
class="bg-gray-300 dark:bg-gray-700 text-white px-2 py-1 mr-2 text-xs inline rounded-lg font-semibold"
|
{{ tag }}
|
||||||
>
|
</span>
|
||||||
{{ form.tags.length-1 }} more
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<extra-menu :form="form" :isMainPage="true" />
|
<extra-menu :form="form" :isMainPage="true" />
|
||||||
|
|
Loading…
Reference in New Issue