From 9e9eff5b41d01a34c2d635bde03cc16d8380d4b3 Mon Sep 17 00:00:00 2001 From: Joshua Pease Date: Tue, 1 Oct 2024 06:22:11 -0700 Subject: [PATCH] [#45] Adds Call To Action block --- ...-534ccdd8-7abd-4300-a102-71885b21c126.yaml | 121 ++++++++++++++++++ ...-7bd21dd3-6b12-4163-8432-030ea6a3f8d3.yaml | 1 + ...-c52a9170-652b-4d92-a226-69894b1822ed.yaml | 21 +++ config/project/project.yaml | 4 +- templates/_blocks/_callToAction.twig | 10 ++ templates/_components/call-to-action.twig | 35 +++++ .../parts-kit/call-to-action/default.twig | 11 ++ 7 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 config/project/entryTypes/callToAction--534ccdd8-7abd-4300-a102-71885b21c126.yaml create mode 100644 config/project/fields/richTextSimple--c52a9170-652b-4d92-a226-69894b1822ed.yaml create mode 100644 templates/_blocks/_callToAction.twig create mode 100644 templates/_components/call-to-action.twig create mode 100644 templates/parts-kit/call-to-action/default.twig diff --git a/config/project/entryTypes/callToAction--534ccdd8-7abd-4300-a102-71885b21c126.yaml b/config/project/entryTypes/callToAction--534ccdd8-7abd-4300-a102-71885b21c126.yaml new file mode 100644 index 0000000..15fc1c5 --- /dev/null +++ b/config/project/entryTypes/callToAction--534ccdd8-7abd-4300-a102-71885b21c126.yaml @@ -0,0 +1,121 @@ +color: null +fieldLayouts: + 1c969fb9-3597-4082-8e64-34c1c9d9a30e: + tabs: + - + elementCondition: null + elements: + - + autocapitalize: true + autocomplete: false + autocorrect: true + class: null + dateAdded: '2024-10-01T00:05:01+00:00' + disabled: false + elementCondition: null + id: null + includeInCards: false + inputType: null + instructions: null + label: null + max: null + min: null + name: null + orientation: null + placeholder: null + providesThumbs: false + readonly: false + requirable: false + size: null + step: null + tip: null + title: null + type: craft\fieldlayoutelements\entries\EntryTitleField + uid: eee9050d-ab79-46d2-87ee-878855f72e52 + userCondition: null + warning: null + width: 100 + - + dateAdded: '2024-10-01T13:11:53+00:00' + elementCondition: null + fieldUid: c52a9170-652b-4d92-a226-69894b1822ed # Rich Text: Simple + handle: null + includeInCards: false + instructions: null + label: Description + providesThumbs: false + required: false + tip: null + type: craft\fieldlayoutelements\CustomField + uid: ba1291b5-b2a2-4ca5-b843-6373de152e83 + userCondition: null + warning: null + width: 100 + - + dateAdded: '2024-10-01T00:12:31+00:00' + elementCondition: null + type: craft\fieldlayoutelements\HorizontalRule + uid: 484dde25-62c7-4238-aea8-6b652747f0e5 + userCondition: null + - + dateAdded: '2024-10-01T00:08:26+00:00' + elementCondition: null + fieldUid: 69fe4c18-21c9-4a3d-8fce-9988d3f741e4 # Link + handle: null + includeInCards: false + instructions: null + label: null + providesThumbs: false + required: false + tip: null + type: craft\fieldlayoutelements\CustomField + uid: 773dfd43-62a1-4bb4-91fa-9856f06fc1a2 + userCondition: null + warning: null + width: 25 + - + dateAdded: '2024-10-01T00:12:31+00:00' + elementCondition: null + fieldUid: 167784f4-27c4-45bc-bcf4-eee051e54bd6 # Open Link In New Window + handle: null + includeInCards: false + instructions: null + label: null + providesThumbs: false + required: false + tip: null + type: craft\fieldlayoutelements\CustomField + uid: f7e9ad77-240d-4431-8815-e37e8c5edd16 + userCondition: null + warning: null + width: 25 + - + dateAdded: '2024-10-01T00:12:31+00:00' + elementCondition: null + fieldUid: b80d8ac7-5039-4535-afa5-82ec086e2f61 # Link Text + handle: null + includeInCards: false + instructions: null + label: null + providesThumbs: false + required: false + tip: null + type: craft\fieldlayoutelements\CustomField + uid: 72e64fac-8f30-4d15-970d-6ae71bfafa56 + userCondition: null + warning: null + width: 50 + name: Content + uid: 8f12bd58-cd2c-4be0-9371-9e66d9828ff5 + userCondition: null +handle: callToAction +hasTitleField: true +icon: diagram-next +name: 'Call To Action' +showSlugField: true +showStatusField: true +slugTranslationKeyFormat: null +slugTranslationMethod: site +titleFormat: '' +titleTranslationKeyFormat: null +titleTranslationMethod: site diff --git a/config/project/fields/pageBlocks--7bd21dd3-6b12-4163-8432-030ea6a3f8d3.yaml b/config/project/fields/pageBlocks--7bd21dd3-6b12-4163-8432-030ea6a3f8d3.yaml index c45204a..4cf4fb3 100644 --- a/config/project/fields/pageBlocks--7bd21dd3-6b12-4163-8432-030ea6a3f8d3.yaml +++ b/config/project/fields/pageBlocks--7bd21dd3-6b12-4163-8432-030ea6a3f8d3.yaml @@ -9,6 +9,7 @@ settings: - 896b8f2a-ed0c-42c9-b5fd-ba8668fc6784 # Rich Text - 7ced3e9d-9b54-47f6-8103-e5c3a4fbaf9c # Card Grid - 3bcf7ddb-71e7-4115-868c-815b3611b34c # Text With Media + - 534ccdd8-7abd-4300-a102-71885b21c126 # Call To Action includeTableView: false maxEntries: null minEntries: null diff --git a/config/project/fields/richTextSimple--c52a9170-652b-4d92-a226-69894b1822ed.yaml b/config/project/fields/richTextSimple--c52a9170-652b-4d92-a226-69894b1822ed.yaml new file mode 100644 index 0000000..5685923 --- /dev/null +++ b/config/project/fields/richTextSimple--c52a9170-652b-4d92-a226-69894b1822ed.yaml @@ -0,0 +1,21 @@ +columnSuffix: null +handle: richTextSimple +instructions: null +name: 'Rich Text: Simple' +searchable: false +settings: + availableTransforms: '' + availableVolumes: '*' + ckeConfig: b7e66782-af96-4012-9e17-914134073ced # Simple + createButtonLabel: null + defaultTransform: null + enableSourceEditingForNonAdmins: false + purifierConfig: null + purifyHtml: true + showUnpermittedFiles: false + showUnpermittedVolumes: false + showWordCount: false + wordLimit: null +translationKeyFormat: null +translationMethod: none +type: craft\ckeditor\Field diff --git a/config/project/project.yaml b/config/project/project.yaml index a9683ea..b741807 100644 --- a/config/project/project.yaml +++ b/config/project/project.yaml @@ -1,4 +1,4 @@ -dateModified: 1727740506 +dateModified: 1727788818 email: fromEmail: $SYSTEM_EMAIL_FROM fromName: 'Viget Craft Starter' @@ -32,6 +32,7 @@ meta: 35b563a0-4662-40b9-b885-a8450a2868d9: 'Viget Craft Starter' # Viget Craft Starter 55cc26b6-8b49-47de-bbe7-5908da6f4545: 'Video Url' # Video Url 69fe4c18-21c9-4a3d-8fce-9988d3f741e4: Link # Link + 534ccdd8-7abd-4300-a102-71885b21c126: 'Call To Action' # Call To Action 570fb481-ad97-46db-8bad-f7b0fd90e831: Image # Image 805d8826-faed-4186-9b88-f509eb9b07e6: 'Viget Craft Starter' # Viget Craft Starter 896b8f2a-ed0c-42c9-b5fd-ba8668fc6784: 'Rich Text' # Rich Text @@ -42,6 +43,7 @@ meta: ac3b0590-d417-429e-aa1f-96be3c79a5b0: 'Media Type' # Media Type b7e66782-af96-4012-9e17-914134073ced: Simple # Simple b80d8ac7-5039-4535-afa5-82ec086e2f61: 'Link Text' # Link Text + c52a9170-652b-4d92-a226-69894b1822ed: 'Rich Text: Simple' # Rich Text: Simple cd489d3c-f914-475c-a270-ab926e4e7485: 'Rich Text' # Rich Text d7f9c488-b14d-48c2-b6fc-d616b7a9f49f: 'Show Media On' # Show Media On plugins: diff --git a/templates/_blocks/_callToAction.twig b/templates/_blocks/_callToAction.twig new file mode 100644 index 0000000..9e622a4 --- /dev/null +++ b/templates/_blocks/_callToAction.twig @@ -0,0 +1,10 @@ +{# @var \craft\elements\Entry|null block #} +{% set block = block ?? null %} + +{{ include('_components/call-to-action.twig', { + title: block.title, + text: block.richTextSimple, + href: block.href, + linkText: block.linkText, + newWindow: block.newWindow, +}) }} diff --git a/templates/_components/call-to-action.twig b/templates/_components/call-to-action.twig new file mode 100644 index 0000000..6a2988e --- /dev/null +++ b/templates/_components/call-to-action.twig @@ -0,0 +1,35 @@ +{# @var string|null title #} +{% set title = title ?? null %} + +{# @var string|null text #} +{% set text = text ?? null %} + +{# @var string|null href #} +{% set href = href ?? null %} + +{# @var string|null linkText #} +{% set linkText = linkText ?? null %} + +{# @var boolean|null newWindow #} +{% set newWindow = newWindow ?? null %} + +
+
+ {% if title %} +

{{ title }}

+ {% endif %} + + {% if text %} +
{{ text }}
+ {% endif %} + + {% if href and linkText %} + {{ include('_components/button.twig', { + href, + newWindow, + text: linkText, + newWindow, + }) }} + {% endif %} +
+
diff --git a/templates/parts-kit/call-to-action/default.twig b/templates/parts-kit/call-to-action/default.twig new file mode 100644 index 0000000..04398e9 --- /dev/null +++ b/templates/parts-kit/call-to-action/default.twig @@ -0,0 +1,11 @@ +{% extends 'viget-parts-kit/layout.twig' %} + +{% block main %} + {{ include('_components/call-to-action.twig', { + title: 'Lorem ipsum dolor sit amet', + text: 'Lorem ipsum dolor sit amet, consectetur adipiscing e lit. Nulla facilisi. Nulla facilisi. Nulla facilisi.', + href: '#TEST', + linkText: 'Button', + newWindow: true, + }) }} +{% endblock %}