Skip to content

Commit

Permalink
Simplify level one blocks
Browse files Browse the repository at this point in the history
* Use replicator_preview: false
* Use validation required
* Remove {{ if }} for required fields
  • Loading branch information
robdekort committed Aug 20, 2020
1 parent 6383eef commit de93f2e
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 34 deletions.
1 change: 1 addition & 0 deletions resources/fieldsets/article.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fields:
localizable: true
listable: hidden
display: Article
replicator_preview: false
validate: required
sets:
figure:
Expand Down
11 changes: 8 additions & 3 deletions resources/fieldsets/button.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ fields:
listable: hidden
display: Label
instructions: 'The text inside the button.'
validate: required
validate:
- required
width: 33
replicator_preview: false
-
handle: link
field:
type: link
localizable: true
display: Link
instructions: 'Where do you want to link to?'
validate: required
width: 66
validate:
- required
width: 66
listable: hidden
replicator_preview: false
1 change: 1 addition & 0 deletions resources/fieldsets/buttons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ fields:
listable: hidden
display: Buttons
instructions: 'Add one or more buttons.'
replicator_preview: false
7 changes: 5 additions & 2 deletions resources/fieldsets/call_to_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ fields:
field: common.title
config:
instructions: 'The title you want to display above the text.'
validate:
- required
-
handle: text
field: common.text_plain
config:
instructions: 'The text you want to display above the buttons.'
validate:
- required
-
handle: buttons
import: buttons
import: buttons
2 changes: 2 additions & 0 deletions resources/fieldsets/collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ fields:
field: common.title
config:
instructions: 'The title you want to display above the collection entries.'
validate:
- required
-
handle: collection
field:
Expand Down
4 changes: 4 additions & 0 deletions resources/fieldsets/form_contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ fields:
field: common.title
config:
instructions: 'The title you want to display above the form.'
validate:
- required
-
handle: text
field: common.text_plain
config:
instructions: 'The text you want to display above the form.'
validate:
- required

9 changes: 9 additions & 0 deletions resources/fieldsets/link_blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ fields:
field: common.title
config:
instructions: 'The title you want to display above the collection entries.'
validate:
- required
-
handle: link_blocks
field:
fields:
-
handle: title
field: common.title
config:
validate:
- required
-
handle: text
field: common.text_plain
config:
validate:
- required
-
import: button
mode: stacked
Expand All @@ -26,3 +34,4 @@ fields:
localizable: false
listable: hidden
display: 'Link blocks'
replicator_preview: false
8 changes: 2 additions & 6 deletions resources/views/page_builder/_call_to_action.antlers.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{{# The call to action content block. #}}
<section class="fluid-container grid md:grid-cols-12 gap-y-8 md:gap-8">
<div class="col-start-3 col-span-8">
{{ if block:title }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
{{ /if }}
{{ if block:text }}
{{ partial:typography/paragraph class="mb-4" :content="block:text" }}
{{ /if }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
{{ partial:typography/paragraph class="mb-4" :content="block:text" }}
{{ if block:buttons }}
{{ partial:components/buttons }}
{{ /if }}
Expand Down
4 changes: 1 addition & 3 deletions resources/views/page_builder/_collection.antlers.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{{# The collection content block with optional title. #}}
<section class="fluid-container grid md:grid-cols-12 gap-y-8 md:gap-8">
<div class="col-start-3 col-span-8">
{{ if block:title }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
{{ /if }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
<ul class="list-inside list-disc">
{{ block:collection }}
<li>
Expand Down
8 changes: 2 additions & 6 deletions resources/views/page_builder/_form_contact.antlers.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{{# The contact form content block. #}}
<section class="fluid-container grid md:grid-cols-12 gap-y-8 md:gap-8">
<div class="col-start-3 col-span-8">
{{ if block:title }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
{{ /if }}
{{ if block:text }}
{{ partial:typography/paragraph :content="block:text" }}
{{ /if }}
{{ partial:typography/h2 class="mb-4" :content="block:title" }}
{{ partial:typography/paragraph :content="block:text" }}

{{# Create a contact form and reference Alpine data in `sending()`. Prevent form from submitting with POST as we will submit with AJAX. #}}
{{ form:create in="contact"
Expand Down
20 changes: 6 additions & 14 deletions resources/views/page_builder/_link_blocks.antlers.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{{# The link blocks content block. #}}
<section class="fluid-container grid md:grid-cols-12 gap-y-8 md:gap-8">
<div class="col-start-3 col-span-8 text-center">
{{ if block:title }}
{{ partial:typography/h2 :content="block:title" }}
{{ /if }}
{{ partial:typography/h2 :content="block:title" }}
</div>
{{ block:link_blocks }}
<a
Expand All @@ -16,18 +14,12 @@
{{ /if }}
>
<div>
{{ if title }}
<span id="{{ title | slugify }}">
{{ partial src="typography/h2" class="mb-2" :content="title" }}
</span>
{{ /if }}
{{ if text }}
{{ partial:typography/paragraph class="mb-4" :content="text" }}
{{ /if }}
<span id="{{ title | slugify }}">
{{ partial src="typography/h2" class="mb-2" :content="title" }}
</span>
{{ partial:typography/paragraph class="mb-4" :content="text" }}
</div>
{{ if label }}
{{ partial:components/button tag="span" }}
{{ /if }}
{{ partial:components/button tag="span" }}
</a>
{{ /block:link_blocks }}
</section>

0 comments on commit de93f2e

Please sign in to comment.