Guest User

Untitled

a guest
May 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.85 KB | None | 0 0
  1. <!-- /templates/page.contact-custom.liquid -->
  2. <div class="wrapper page-margin" data-section-id="{{ section.id }}">
  3.  
  4. <div class="grid">
  5.  
  6. <div class="grid__item large--two-thirds push--large--one-sixth">
  7.  
  8. <h1 class="text-center h2">{{ page.title }}</h1>
  9.  
  10. {% if section.settings.title != blank %}
  11. <h4 class="home__subtitle">{{ section.settings.title}}</h4>
  12. {% endif %}
  13.  
  14. <div>
  15. {% form 'contact' %}
  16. {% if form.posted_successfully? %}
  17.  
  18. <p class="note form-success">
  19. {{ 'contact.form.post_success' | t }}
  20. </p>
  21. {% endif %}
  22.  
  23. {{ form.errors | default_errors }}
  24.  
  25. {% for block in section.blocks %}
  26.  
  27. {% case block.type %}
  28.  
  29. {% when 'email' %}
  30. <div class="custom-form__block" {{ block.shopify_attributes }}>
  31. <label for="{{ block.settings.label }}" class="label--hidden">{{ block.settings.label }}</label>
  32. <input type="email" class="contactFormEmail" id="Form-{{ section.id }}-{{forloop.index0 }}" name="contact[email]" placeholder="{{ block.settings.label }}" autocorrect="off" autocapitalize="off" />
  33. </div>
  34.  
  35. {% when 'body' %}
  36. <div class="custom-form__block" {{ block.shopify_attributes }}>
  37. <label for="{{ block.settings.label }}" class="label--hidden">{{ block.settings.label }}</label>
  38. <textarea rows="10" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormMessage" name="contact[body]" placeholder="{{ block.settings.label }}"></textarea>
  39. </div>
  40.  
  41. {% when 'text' %}
  42. <div class="custom-form__block" {{ block.shopify_attributes }}>
  43. <label for="{{ block.settings.label }}" class="label--hidden uppercase">{{ block.settings.label }}</label>
  44. <input type="text" class="contactFormText" id="Form-{{ section.id }}-{{forloop.index0 }}" name="contact[{{ block.settings.label | escape }}]" placeholder="{{ block.settings.label }}" autocapitalize="words" value="" />
  45. </div>
  46.  
  47. {% when 'textarea' %}
  48. <div class="custom-form__block" {{ block.shopify_attributes }}>
  49. <label for="{{ block.settings.label }}" class="label--hidden">{{ block.settings.label }}</label>
  50. <textarea rows="10" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormMessage" name="contact[{{ block.settings.label | escape }}]" placeholder="{{ block.settings.label }}"></textarea>
  51. </div>
  52.  
  53. {% when 'telephone' %}
  54. <div class="custom-form__block" {{ block.shopify_attributes }}>
  55. <label for="{{ block.settings.label }}" class="label--hidden">{{ block.settings.label }}</label>
  56. <input type="tel" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormPhone" name="contact[{{ block.settings.label | escape }}]" placeholder="{{ block.settings.label }}" pattern="[0-9\-]*" value="" />
  57. </div>
  58.  
  59. {% when 'name' %}
  60. <div class="custom-form__block" {{ block.shopify_attributes }}>
  61. <label for="{{ block.settings.label }}" class="label--hidden uppercase">{{ block.settings.label }}</label>
  62. <input type="text" class="contactFormText" id="Form-{{ section.id }}-{{forloop.index0 }}" name="contact[{{ block.settings.label | escape }}]" placeholder="{{ block.settings.label }}" autocapitalize="words" value="" />
  63. </div>
  64.  
  65. {% when 'radio' %}
  66. <div class="custom-form__block" {{ block.shopify_attributes }}>
  67. <label for="{{ block.settings.label }} "class="label uppercase">{{ block.settings.name }}:</label>
  68. {% if block.settings.label-one != blank %}
  69. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-one }}"> {{ block.settings.label-one }}</input><br />
  70. {% endif %}
  71. {% if block.settings.label-two != blank %}
  72. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-two }}"> {{ block.settings.label-two }}</input><br />
  73. {% endif %}
  74. {% if block.settings.label-three != blank %}
  75. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-three }}"> {{ block.settings.label-three }}</input><br />
  76. {% endif %}
  77. {% if block.settings.label-four != blank %}
  78. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-four }}"> {{ block.settings.label-four }}</input><br />
  79. {% endif %}
  80. {% if block.settings.label-five != blank %}
  81. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-five }}"> {{ block.settings.label-five }}</input><br />
  82. {% endif %}
  83. {% if block.settings.label-six != blank %}
  84. <input type="radio" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormRadio" name="contact[{{ block.settings.name | escape }}]" value="{{ block.settings.label-six }}"> {{ block.settings.label-six }}</input><br />
  85. {% endif %}
  86. </div>
  87.  
  88. {% when 'checkboxHeading' %}
  89. <div class="custom-form__block" {{ block.shopify_attributes }}>
  90. <label for="{{ block.settings.label }}" class="label uppercase">{{ block.settings.label }}:</label>
  91. </div>
  92.  
  93. {% when 'checkbox' %}
  94. <div class="custom-form__block" {{ block.shopify_attributes }}>
  95. <label for="{{ block.settings.label }}" class="label--hidden">{{ block.settings.label }}</label>
  96. <input type="checkbox" id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormCheckbox" name="contact[{{ block.settings.label }}]" value="{{ block.settings.label }}"> {{ block.settings.label }}</input>
  97. </div>
  98.  
  99. {% when 'select' %}
  100. <div class="custom-form__block" {{ block.shopify_attributes }}>
  101. <label for="{{ block.settings.label }}" class="label">{{ block.settings.name }}:</label>
  102. <select id="Form-{{ section.id }}-{{ forloop.index0 }}" class="contactFormSelect" name="contact[{{ block.settings.name }}]">
  103. {% if block.settings.label-one != blank %}
  104. <option value="{{ block.settings.label-one }}">{{ block.settings.label-one }}</option>
  105. {% endif %}
  106. {% if block.settings.label-two != blank %}
  107. <option value="{{ block.settings.label-two }}">{{ block.settings.label-two }}</option>
  108. {% endif %}
  109. {% if block.settings.label-three != blank %}
  110. <option value="{{ block.settings.label-three }}">{{ block.settings.label-three }}</option>
  111. {% endif %}
  112. {% if block.settings.label-four != blank %}
  113. <option value="{{ block.settings.label-four }}">{{ block.settings.label-four }}</option>
  114. {% endif %}
  115. {% if block.settings.label-five != blank %}
  116. <option value="{{ block.settings.label-five }}">{{ block.settings.label-five }}</option>
  117. {% endif %}
  118. {% if block.settings.label-six != blank %}
  119. <option value="{{ block.settings.label-six }}">{{ block.settings.label-six }}</option>
  120. {% endif %}
  121.  
  122. </select>
  123. </div>
  124. {% else %}
  125. {% endcase %}
  126.  
  127. {% endfor %}
  128.  
  129. {% assign types = '' %}
  130. {% for block in section.blocks %}
  131. {% assign types = types | append: block.type %}
  132. {% endfor %}
  133.  
  134. <!-- <p>TYPES:{{ types }}</p> -->
  135.  
  136. {% unless types contains "email" %}
  137. <label for="{{ block.settings.label }}" class="label">{{ block.settings.label }}</label>
  138. <input type="email" class="contactFormEmail" id="Form-{{ section.id }}" name="contact[email]" placeholder="Email address (required)" autocorrect="off" autocapitalize="off" >
  139. {% endunless %}
  140.  
  141. {% unless types contains "body" %}
  142. <label for="{{ block.settings.label }}" class="label">{{ block.settings.label }}</label>
  143. <textarea rows="10" id="Form-{{ section.id }}" class="contactFormMessage" name="contact[body]" placeholder="Message (required)"></textarea>
  144. {% endunless %}
  145.  
  146. <input type="submit" class="btn right uppercase" value="{{ 'contact.form.send' | t }}">
  147.  
  148. {% endform %}
  149.  
  150. </div>
  151.  
  152. <div class="rte" style="margin-top: 5rem;">
  153. {{ page.content }}
  154. </div>
  155.  
  156. </div>
  157.  
  158. </div>
  159.  
  160. </div>
  161.  
  162.  
  163.  
  164. {% schema %}
  165. {
  166. "name": "Contact Form",
  167. "class": "index-section",
  168. "settings": [
  169. {
  170. "type": "text",
  171. "id": "title",
  172. "label": "Heading",
  173. "default": "Form"
  174. }
  175. ],
  176. "blocks": [
  177. {
  178. "type": "email",
  179. "name": "Email field",
  180. "limit": 1,
  181. "settings": [
  182. {
  183. "type": "text",
  184. "id": "label",
  185. "label": "Label",
  186. "default": "Email"
  187. }
  188. ]
  189. },
  190. {
  191. "type": "body",
  192. "name": "Body field",
  193. "limit": 1,
  194. "settings": [
  195. {
  196. "type": "textarea",
  197. "id": "label",
  198. "label": "Label",
  199. "default": "Message"
  200. }
  201. ]
  202. },
  203. {
  204. "type": "text",
  205. "name": "Text field",
  206. "settings": [
  207. {
  208. "type": "text",
  209. "id": "label",
  210. "label": "Label",
  211. "default": "Full Name",
  212. "info": "Example: Full Name"
  213. }
  214. ]
  215. },
  216. {
  217. "type": "telephone",
  218. "name": "Telephone field",
  219. "settings": [
  220. {
  221. "type": "text",
  222. "id": "label",
  223. "label": "Label",
  224. "default": "Phone Number",
  225. "info": "Example: Mobile Number"
  226. }
  227. ]
  228. },
  229. {
  230. "type": "textarea",
  231. "name": "Text area",
  232. "settings": [
  233. {
  234. "type": "textarea",
  235. "id": "label",
  236. "label": "Label",
  237. "default": "Enter your message",
  238. "info": "Example: Enter your message"
  239. }
  240. ]
  241. },
  242. {
  243. "type": "checkbox",
  244. "name": "Single checkbox",
  245. "settings": [
  246. {
  247. "type": "text",
  248. "id": "label",
  249. "default": "Newsletter One",
  250. "label": "Label",
  251. "info": "Example: Weekly newsletter"
  252. }
  253. ]
  254. },
  255. {
  256. "type": "checkboxHeading",
  257. "name": "Checkbox heading",
  258. "settings": [
  259. {
  260. "type": "text",
  261. "id": "label",
  262. "default": "Checkbox heading",
  263. "label": "Label",
  264. "info": "Example: Subscribe to Newsletters"
  265. }
  266. ]
  267. },
  268. {
  269. "type": "radio",
  270. "name": "Radio group",
  271. "settings": [
  272. {
  273. "type": "text",
  274. "id": "name",
  275. "default": "Pick an option",
  276. "label": "Heading",
  277. "info": "Example: Choose an option"
  278. },
  279. {
  280. "type": "text",
  281. "id": "label-one",
  282. "default": "Radio option 1",
  283. "label": "Option one",
  284. "info": "Example: Option 1"
  285. },
  286. {
  287. "type": "text",
  288. "id": "label-two",
  289. "default": "Radio option 2",
  290. "label": "Option two",
  291. "info": "Example: Option 2"
  292. },
  293. {
  294. "type": "text",
  295. "id": "label-three",
  296. "default": "Radio option 3",
  297. "label": "Option three",
  298. "info": "Blank if not required"
  299. },
  300. {
  301. "type": "text",
  302. "id": "label-four",
  303. "default": "Radio option 4",
  304. "label": "Option four",
  305. "info": "Blank if not required"
  306. },
  307. {
  308. "type": "text",
  309. "id": "label-five",
  310. "default": "Radio option 5",
  311. "label": "Option five",
  312. "info": "Blank if not required"
  313. },
  314. {
  315. "type": "text",
  316. "id": "label-six",
  317. "default": "Radio option 6",
  318. "label": "Option six",
  319. "info": "Blank if not required"
  320. }
  321. ]
  322. },
  323. {
  324. "type": "select",
  325. "name": "Select group",
  326. "settings": [
  327. {
  328. "type": "text",
  329. "id": "name",
  330. "default": "Select an option",
  331. "label": "Instructions",
  332. "info": "Example: Choose a delivery location"
  333. },
  334. {
  335. "type": "text",
  336. "id": "label-one",
  337. "default": "Select option 1",
  338. "label": "Option one",
  339. "info": "Example: Home Address"
  340. },
  341. {
  342. "type": "text",
  343. "id": "label-two",
  344. "default": "Select option 2",
  345. "label": "Option two",
  346. "info": "Example: Work Address"
  347. },
  348. {
  349. "type": "text",
  350. "id": "label-three",
  351. "default": "Select option 3",
  352. "label": "Option three",
  353. "info": "Blank if not required"
  354. },
  355. {
  356. "type": "text",
  357. "id": "label-four",
  358. "default": "Select option 4",
  359. "label": "Option four",
  360. "info": "Blank if not required"
  361. },
  362. {
  363. "type": "text",
  364. "id": "label-five",
  365. "default": "Select option 5",
  366. "label": "Option five",
  367. "info": "Blank if not required"
  368. },
  369. {
  370. "type": "text",
  371. "id": "label-six",
  372. "default": "Select option 6",
  373. "label": "Option six",
  374. "info": "Blank if not required"
  375. }
  376. ]
  377. }
  378. ],
  379. "presets": [
  380. {
  381. "name": "Contact Form",
  382. "category": "Form",
  383. "blocks": [
  384. {
  385. "type": "email"
  386. },
  387. {
  388. "type": "body"
  389. }
  390. ]
  391. }
  392. ]
  393. }
  394. {% endschema %}
Add Comment
Please, Sign In to add comment