Skip to content

Commit

Permalink
Merge pull request #7 from lucky-media/v1.4
Browse files Browse the repository at this point in the history
🚀 v1.4 Release
  • Loading branch information
Afan417 authored May 28, 2024
2 parents 0627ee1 + 79adfdc commit 4b4de42
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 141 deletions.
1 change: 1 addition & 0 deletions content/collections/pages/employment-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ required_fields_text: '* Required fields'
protected_page: false
submit_options: thankyou_page
submit_title: 'Thank you. Your form is submitted.'
success_message_duration: 4
updated_by: c4788818-bedf-422a-ad20-bc93b90731e8
updated_at: 1695393851
---
26 changes: 26 additions & 0 deletions public/build/assets/site-77a4b0d4.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"src": "resources/css/site.css"
},
"resources/js/site.js": {
"file": "assets/site-a126440d.js",
"file": "assets/site-77a4b0d4.js",
"isEntry": true,
"src": "resources/js/site.js"
}
Expand Down
139 changes: 14 additions & 125 deletions resources/blueprints/collections/pages/formatic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,12 @@ tabs:
validate:
- required
display: 'Page Header'
instructions_position: above
listable: hidden
visibility: visible
input_type: text
antlers: false
hide_display: false
-
handle: page_description
field:
antlers: false
type: textarea
display: 'Page Description'
icon: textarea
instructions: 'Displayed under the title'
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
display: 'Form Builder'
fields:
Expand All @@ -46,44 +34,24 @@ tabs:
handle: logo
field:
max_files: 1
mode: list
container: assets
restrict: false
allow_uploads: true
show_filename: true
show_set_alt: true
type: assets
display: 'Logo Light'
icon: assets
instructions: |-
The light version of the Logo.
It is displayed above the title.
width: 50
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: logo_dark
field:
max_files: 1
mode: list
container: assets
restrict: false
allow_uploads: true
show_filename: true
show_set_alt: true
type: assets
display: 'Logo Dark'
icon: assets
instructions: |-
The dark version of the Logo.
It is displayed above the title.
width: 50
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: logo_size
field:
Expand All @@ -94,11 +62,6 @@ tabs:
default: medium
type: button_group
display: 'Logo Size'
icon: button_group
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: theme_color
field:
Expand All @@ -119,12 +82,7 @@ tabs:
default: '#e11d48'
type: color
display: 'Theme Color'
icon: color
width: 25
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: theme_radius
field:
Expand All @@ -137,13 +95,8 @@ tabs:
default: 0.5rem
type: button_group
display: Radius
icon: button_group
instructions: 'The border radius of the elements.'
width: 75
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
display: Settings
fields:
Expand All @@ -153,13 +106,8 @@ tabs:
default: true
type: toggle
display: 'Darkmode Toggle'
icon: toggle
instructions: 'Enable or Disable the Darkmode Toggle.'
width: 50
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: theme_mode
field:
Expand All @@ -169,12 +117,7 @@ tabs:
auto: Auto
type: button_group
display: 'Theme Mode'
icon: button_group
instructions: 'Auto will respect the users preference.'
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
if:
darkmode_toggle: 'equals false'
-
Expand All @@ -187,62 +130,33 @@ tabs:
default: medium
type: button_group
display: 'Form Size'
icon: button_group
width: 50
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: required_fields_text
field:
input_type: text
default: '* Required fields'
antlers: false
type: text
display: 'Required Fields Text'
icon: text
width: 50
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: protect_spacer
field:
type: spacer
display: 'Protect Spacer'
icon: width
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: protected_page
field:
default: false
type: toggle
display: 'Protected Page'
icon: toggle
width: 33
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
-
handle: protect
field:
input_type: text
default: password
antlers: false
type: text
display: Protect
icon: text
width: 66
listable: hidden
instructions_position: above
visibility: read_only
hide_display: false
if:
protected_page: 'equals true'
-
Expand All @@ -257,25 +171,26 @@ tabs:
default: thankyou_page
type: button_group
display: 'Submit Options'
icon: button_group
instructions: 'Choose what to do after the Form is submitted.'
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
width: 50
-
handle: success_message_duration
field:
min: 1
default: 4
type: range
display: 'Success Message Duration'
instructions: 'The duration (in seconds) for which the success message remains visible after form submission.'
width: 50
if:
submit_options: 'equals thankyou_page'
max: 10
-
handle: submit_title
field:
input_type: text
default: 'Thank you. Your form is submitted.'
antlers: false
type: text
display: 'Submit Title'
icon: text
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
validate:
- 'required_if:submit_options,thankyou_page'
if:
Expand All @@ -291,46 +206,19 @@ tabs:
- removeformat
- quote
- anchor
smart_typography: false
save_html: false
inline: false
toolbar_mode: fixed
reading_time: false
word_count: false
fullscreen: true
allow_source: false
enable_input_rules: true
enable_paste_rules: true
remove_empty_nodes: false
antlers: false
link_noopener: false
link_noreferrer: false
target_blank: false
always_show_set_button: false
collapse: false
previews: true
type: bard
display: 'Submit Description'
icon: bard
listable: hidden
instructions_position: above
visibility: visible
hide_display: false
if:
submit_options: 'equals thankyou_page'
-
handle: page_redirect_url
field:
input_type: url
antlers: false
type: text
display: 'Redirect URL'
icon: text
listable: hidden
instructions_position: above
visibility: visible
duplicate: false
hide_display: false
if:
submit_options: 'equals page_redirect'
validate:
Expand All @@ -345,6 +233,7 @@ tabs:
field:
type: slug
localizable: true
validate: 'max:200'
-
handle: parent
field:
Expand Down
12 changes: 7 additions & 5 deletions resources/js/form/Formatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const Formatic = () => ({
steps: [],
currentStep: 1,
redirect_url: null,
success_message_duration: 4,
submit_url: null,
success: false,
form: "",
Expand Down Expand Up @@ -57,17 +58,18 @@ export const Formatic = () => ({
this.form.errors = {};
this.success = true;

setTimeout(() => {
if (this.redirect_url) {
this.success = false;
return (window.location.href = this.redirect_url);
}

if (this.redirect_url) {
window.location.href = this.redirect_url;
}
setTimeout(() => {
this.success = false;

if (this.isMultiStep()) {
location.reload();
}
}, 1000);
}, this.success_message_duration * 1000);
}
} catch (error) {
if (error.response && error.response.data.errors) {
Expand Down
4 changes: 4 additions & 0 deletions resources/sites.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default:
name: '{{ config:app:name }}'
locale: en_US
url: /
18 changes: 9 additions & 9 deletions resources/views/partials/sets/formatic.antlers.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<x-block form_size="{form_size}">
{{ form:create :in="selected_form:handle" js="alpine:form" attr:x-ref="form" files="true" }}
<div x-data="formatic()">
<template x-if="success">
{{ if submit_options === 'thankyou_page' }}
<div x-data="formatic()" x-init="() => { success_message_duration = '{{ success_message_duration }}' }">
{{ if submit_options === 'thankyou_page' }}
<template x-if="success">
<x-alert class="mb-5">
{{ svg src="check" class="w-6 h-6" }}
<x-alert.title>{{ submit_title }}</x-alert.title>
Expand All @@ -12,11 +12,11 @@
</x-prose>
{{ /if }}
</x-alert>
{{ else }}
<div class="hidden" x-init="() => { redirect_url = '{{ page_redirect_url }}' }">
</div>
{{ /if }}
</template>
</template>
{{ else }}
<div class="hidden" x-init="() => { redirect_url = '{{ page_redirect_url }}' }">
</div>
{{ /if }}
<template x-if="!success">
<div>
{{ if show_sections }}
Expand Down Expand Up @@ -48,4 +48,4 @@
</template>
</div>
{{ /form:create }}
</x-block>
</x-block>
3 changes: 2 additions & 1 deletion starter-kit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export_paths:
- content/collections/pages/employment-application.md
- config/statamic/assets.php
- config/statamic/protect.php
- resources/sites.yaml
- resources/forms/employment_application.yaml
- resources/fieldsets
- resources/blueprints/globals/formatic.yaml
Expand All @@ -29,4 +30,4 @@ export_paths:
- README.md
dependencies:
marcorieser/tailwind-merge-statamic: ^1.1.0
stillat/antlers-components: ^2.0
stillat/antlers-components: ^2.2.0

0 comments on commit 4b4de42

Please sign in to comment.