diff --git a/website/Contactform.html b/website/Contactform.html new file mode 100644 index 0000000..2027d65 --- /dev/null +++ b/website/Contactform.html @@ -0,0 +1,390 @@ +
+
+ {% form 'contact' %} + {% if form.posted_successfully? %} +

{{ 'contact.form.post_success' | t }}

+ + + {% else %} + + {% if section.settings.contact_title != blank or section.settings.contact_text != blank %} +
+ {% if section.settings.contact_title != blank %} +

{{ section.settings.contact_title | escape }}

+{% endif %} + + + {% if section.settings.contact_text != blank %} +
{{ section.settings.contact_text }}
+ {% endif %} +
+ {% endif %} + + {% if form.errors %} + + {% endif %} + + {%- if request.design_mode -%} + {%- liquid + assign email_exists = false + for block in section.blocks + if block.type == 'email_input' + assign email_exists = true + endif + endfor + -%} + {%- if email_exists == false -%} +
You must include the 'Email input' block for the form to work correctly.
+ {%- endif -%} + {%- endif -%} + +
+ {% for block in section.blocks %} +
+ {% case block.type %} + {% when 'name_input' %} + + + + {% when 'email_input' %} + + + + {% when 'message_input' %} + + + + {% when 'phone_input' %} + + + + {% when 'custom_input' %} + {% if block.settings.title != blank %} + {%- assign title_handle = block.settings.title | handle -%} + + {% if block.settings.type == 'textarea' %} + + {% else %} + + {% endif %} + {% endif %} + + {% when 'custom_dropdown' %} + {% if block.settings.title != blank %} + {%- liquid + assign custom_options = block.settings.multiple_options | newline_to_br | strip_newlines | split: '
' + assign input_id = block.settings.title | handle | prepend: 'contact_' + assign input_name = block.settings.title | handle | prepend: 'contact[' | append: ']' + -%} +
+ {% render 'custom-select', + id: input_id, + label: block.settings.title, + option_values: custom_options, + selected_value: custom_options.first, + include_native: true, + native_name: input_name + %} +
+ {% endif %} + + {% when 'text' %} +
{{ block.settings.text }}
+ + {% endcase %} +
+ {% endfor %} +
+ +
+ +
+ +
+ +
+ + {% endif %} + {% endform %} +
+
+ + + +{% schema %} + { + "name": "Contact form", + "class": "section-contact-form", + "settings": [ + { + "type": "text", + "id": "contact_title", + "label": "Heading", + "default": "Contact us" + }, + { + "type": "richtext", + "id": "contact_text", + "label": "Introduction" + } + ], + "blocks": [ + { + "type": "name_input", + "name": "Name input", + "limit": 1, + "settings": [ + { + "type": "paragraph", + "content": "The label can be changed in the translation editor." + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "email_input", + "name": "Email input", + "limit": 1, + "settings": [ + { + "type": "paragraph", + "content": "REQUIRED - Contact form will not work if this block is removed." + }, + { + "type": "paragraph", + "content": "The label can be changed in the translation editor." + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "message_input", + "name": "Message input", + "limit": 1, + "settings": [ + { + "type": "paragraph", + "content": "The label can be changed in the translation editor." + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "phone_input", + "name": "Phone input", + "limit": 1, + "settings": [ + { + "type": "checkbox", + "id": "required", + "label": "Required", + "default": false + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "custom_input", + "name": "Custom input", + "settings": [ + { + "type": "paragraph", + "content": "Custom inputs require a label, and that label may only be used once in the form." + }, + { + "type": "text", + "id": "title", + "label": "Label", + "default": "Custom input" + }, + { + "type": "select", + "id": "type", + "label": "Type", + "default": "text", + "options": [ + { + "label": "Text", + "value": "text" + }, + { + "label": "Number", + "value": "number" + }, + { + "label": "Email", + "value": "email" + }, + { + "label": "Text area", + "value": "textarea" + } + ] + }, + { + "type": "checkbox", + "id": "required", + "label": "Required", + "default": false + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "custom_dropdown", + "name": "Custom dropdown", + "settings": [ + { + "type": "paragraph", + "content": "Custom dropdowns require a label, and that label may only be used once in the form." + }, + { + "type": "text", + "id": "title", + "label": "Label", + "default": "Custom dropdown" + }, + { + "type": "textarea", + "id": "multiple_options", + "label": "Options", + "default": "Option 1\nOption 2\nOption 3", + "info": "One option on each line" + }, + { + "type": "checkbox", + "id": "half_width", + "label": "Half width", + "default": false + } + ] + }, + { + "type": "text", + "name": "Text", + "settings": [ + { + "type": "richtext", + "id": "text", + "label": "Text", + "default": "

Text content

" + } + ] + } + ], + "presets": [ + { + "name": "Contact form", + "blocks": [ + { + "type": "name_input", + "settings": { + "half_width": true + } + }, + { + "type": "email_input", + "settings": { + "half_width": true + } + }, + { + "type": "message_input" + } + ] + } + ] + } +{% endschema %} diff --git a/website/temp b/website/temp new file mode 100644 index 0000000..2325889 --- /dev/null +++ b/website/temp @@ -0,0 +1,25 @@ + + + + + +
+ + +
+ \ No newline at end of file