Browse Source

feat: add attachments and success_url options to contact form (#2394)

Scope: Netlify forms
rodrigoalcarazdelaosa 3 years ago
parent
commit
cda364b190

+ 5 - 3
wowchemy/i18n/ca.yaml

@@ -75,13 +75,15 @@
 - id: more_publications
   translation: Més publicacions
 - id: contact_name
-  translation: Name
+  translation: Nom
 - id: contact_email
   translation: Email
 - id: contact_message
-  translation: Message
+  translation: Missatge
+- id: contact_attachment
+  translation: Adjunt  
 - id: contact_send
-  translation: Send
+  translation: Enviar
 - id: book_appointment
   translation: Book an appointment
 - id: abstract

+ 3 - 0
wowchemy/i18n/en.yaml

@@ -138,6 +138,9 @@
 
 - id: contact_message
   translation: Message
+  
+- id: contact_attachment
+  translation: Attach file
 
 - id: contact_send
   translation: Send

+ 2 - 0
wowchemy/i18n/es.yaml

@@ -80,6 +80,8 @@
   translation: Email
 - id: contact_message
   translation: Mensaje
+- id: contact_attachment
+  translation: Adjunto  
 - id: contact_send
   translation: Enviar
 - id: book_appointment

+ 7 - 1
wowchemy/layouts/partials/widgets/contact.html

@@ -38,7 +38,7 @@
     {{ end }}
 
     <div class="mb-3">
-      <form name="contact" method="POST" {{ $post_action | safeHTMLAttr }} {{ if $use_netlify_form }}netlify-honeypot="_gotcha"{{ end }} {{ if $use_netlify_captcha }}data-netlify-recaptcha="true"{{ end }}>
+      <form name="contact" method="POST" {{ $post_action | safeHTMLAttr }} {{ if $use_netlify_form }}netlify-honeypot="_gotcha"{{ end }} {{ if $use_netlify_captcha }}data-netlify-recaptcha="true"{{ end }} {{ with $st.Params.content.form.netlify.success_url }}action="{{ . | relLangURL }}"{{ end }}>
         <div class="form-group form-inline">
           <label class="sr-only" for="inputName">{{ i18n "contact_name" }}</label>
           <input type="text" name="name" class="form-control w-100" id="inputName" placeholder="{{ i18n "contact_name" | default "Name" }}" required>
@@ -51,6 +51,12 @@
           <label class="sr-only" for="inputMessage">{{ i18n "contact_message" }}</label>
           <textarea name="message" class="form-control" id="inputMessage" rows="5" placeholder="{{ i18n "contact_message" | default "Message" }}" required></textarea>
         </div>
+        {{ if $st.Params.content.form.netlify.attachments }}
+          <div class="form-group form-inline">
+            <label class="sr-only" for="fileUpload">{{ i18n "contact_attachment" }}</label>
+            <input type="file" name="file" class="form-control w-100" id="fileUpload" placeholder="{{ i18n "contact_attachment" | default "Attach file" }}">
+          </div>
+        {{ end }}
         <div class="d-none">
           <label>Do not fill this field unless you are a bot: <input name="_gotcha"></label>
         </div>