From 0807af24745c999e3fea7deabcd7819ce240360f Mon Sep 17 00:00:00 2001
From: Tobias Huste <t.huste@hzdr.de>
Date: Tue, 4 Aug 2020 15:38:31 +0200
Subject: [PATCH] Embed Zammad support form into contacts page

---
 .gitmodules                 |  3 +++
 _includes/contact_form.html | 18 ++++++++++++++++++
 assets/css/contact.scss     | 19 +++++++++++++++++++
 assets/css/hifis.scss       |  1 +
 assets/vendor/jquery        |  1 +
 contact.md                  |  6 +++++-
 6 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 _includes/contact_form.html
 create mode 100644 assets/css/contact.scss
 create mode 160000 assets/vendor/jquery

diff --git a/.gitmodules b/.gitmodules
index fa88a70ff..ffe38aa89 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
 [submodule "assets/vendor/MathJax"]
 	path = assets/vendor/MathJax
 	url = https://github.com/mathjax/MathJax.git
+[submodule "assets/vendor/jquery"]
+	path = assets/vendor/jquery
+	url = https://github.com/jquery/jquery.git
diff --git a/_includes/contact_form.html b/_includes/contact_form.html
new file mode 100644
index 000000000..82784adcf
--- /dev/null
+++ b/_includes/contact_form.html
@@ -0,0 +1,18 @@
+<div id="feedback-form">form will be placed in here</div>
+
+<script type="text/javascript"
+        src="{{ site.directory.vendor | append: 'jquery/dist/jquery.min.js' | strip | relative_url }}">
+</script>
+<script id="zammad_form_script" src="https://hifis-help.hzdr.de/assets/form/form.js"></script>
+
+<script>
+$(function () {
+    $('#feedback-form').ZammadForm({
+        messageTitle: 'Contact HIFIS',
+        messageSubmit: 'Submit',
+        messageThankYou: 'Thank you for your request (#%s). You will hear from us soon!',
+        attachmentSupport: true,
+        noCSS: true,
+    });
+});
+</script>
diff --git a/assets/css/contact.scss b/assets/css/contact.scss
new file mode 100644
index 000000000..5cef3037d
--- /dev/null
+++ b/assets/css/contact.scss
@@ -0,0 +1,19 @@
+---
+---
+
+@import  "bootstrap_variables";
+
+@import "assets/vendor/bootstrap/scss/functions";
+@import "assets/vendor/bootstrap/scss/variables";
+@import "assets/vendor/bootstrap/scss/mixins";
+
+@import "assets/vendor/bootstrap/scss/buttons";
+
+.form-control {
+    width: -webkit-fill-available;
+    width: -moz-available;
+}
+
+.btn {
+    @extend .btn-primary;
+}
diff --git a/assets/css/hifis.scss b/assets/css/hifis.scss
index 00315bf99..2551bb6c6 100644
--- a/assets/css/hifis.scss
+++ b/assets/css/hifis.scss
@@ -31,6 +31,7 @@
 @import "assets/vendor/bootstrap/scss/buttons";
 @import "assets/vendor/bootstrap/scss/card";
 @import "assets/vendor/bootstrap/scss/close";
+@import "assets/vendor/bootstrap/scss/forms";
 @import "assets/vendor/bootstrap/scss/jumbotron";
 @import "assets/vendor/bootstrap/scss/toasts";
 @import "assets/vendor/bootstrap/scss/tooltip";
diff --git a/assets/vendor/jquery b/assets/vendor/jquery
new file mode 160000
index 000000000..e1cffdef2
--- /dev/null
+++ b/assets/vendor/jquery
@@ -0,0 +1 @@
+Subproject commit e1cffdef277fcf543833a20d28cbadcd000ebece
diff --git a/contact.md b/contact.md
index b269c8b00..d15674aa7 100644
--- a/contact.md
+++ b/contact.md
@@ -5,9 +5,13 @@ layout: default
 excerpt:
     Contact to HIFIS Office.
 lang: en
-lang_ref: contact    
+lang_ref: contact
+additional_css:
+  - contact.css
 ---
 
+{% include contact_form.html %}
+
 ## Questions to this website? Contact us!
 {:.text-success}
 #### Uwe Jandt
-- 
GitLab