]> _ Git - ccv-wordpress.git/commitdiff
WIP #3445 @3
authorStephen Cameron <stephen@cubedesigners.com>
Mon, 30 Mar 2020 17:29:33 +0000 (19:29 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Mon, 30 Mar 2020 17:29:33 +0000 (19:29 +0200)
wp-content/mu-plugins/cube/src/Init.php
wp-content/mu-plugins/cube/src/Shortcodes/CCVForm.php [new file with mode: 0644]
wp-content/themes/CCV/resources/views/forms/consultation.blade.php [new file with mode: 0644]

index 3762fdf3042e556d55bd00137684795927104eb8..e2550dd52cf245c34b7a0aff5a10cfbb37348768 100644 (file)
@@ -17,6 +17,7 @@ final class Init { // Marked as final because this class should never be extende
             Elementor\Setup::class,
             CPT\Person::class,
             CPT\ScientificNews::class,
+            Shortcodes\CCVForm::class,
         ];
     }
 
diff --git a/wp-content/mu-plugins/cube/src/Shortcodes/CCVForm.php b/wp-content/mu-plugins/cube/src/Shortcodes/CCVForm.php
new file mode 100644 (file)
index 0000000..a1d0857
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Cube\Shortcodes;
+
+use function Roots\view;
+
+class CCVForm {
+
+    /**
+     * Common setup, will be automatically triggered by Init class if included
+     */
+    public function register() {
+
+        // Register [ccv_form] shortcode
+        add_shortcode('ccv_form', [$this, 'shortcode']);
+
+        add_action( 'wp_enqueue_scripts', function() {
+            // TODO: Register all necessary scripts and styles here (flatpickr, Parsely etc). See https://wordpress.stackexchange.com/q/165754
+        });
+
+    }
+
+    public function shortcode($attributes) {
+
+        // TODO: enqueue scripts and styles here when shortcode is actually used (avoids unwanted script inclusion on other pages)
+
+        extract(shortcode_atts([
+            'name' => '', // Name of the form template
+        ], $attributes));
+
+        // List of all possible forms
+        $templates = [
+            'consultation',
+        ];
+
+        if (in_array($name, $templates)) {
+            return view("forms/$name");
+        }
+
+        return false;
+    }
+
+}
diff --git a/wp-content/themes/CCV/resources/views/forms/consultation.blade.php b/wp-content/themes/CCV/resources/views/forms/consultation.blade.php
new file mode 100644 (file)
index 0000000..dc0fdbb
--- /dev/null
@@ -0,0 +1,42 @@
+{{-- CONSULTATION FORM --}}
+
+{{-- SYMPTOMS --}}
+<div class="bg-light py-2v pl-4v pr-3v">
+  <h2>{{ __('1. Vos symptômes') }}</h2>
+
+  <ul>
+    <li>
+      {{ __('Problème principal', 'ccv') }}
+
+      <div class="flex justify-between items-center">
+        <label>
+          <input type="radio" name="problem-principal" value="{{ __('Cervicales', 'ccv') }}">
+          <span class="ml-2">{{ __('Cervicales') }}</span>
+        </label>
+        <label>
+          <input type="radio" name="problem-principal" value="{{ __('Lombaires', 'ccv') }}">
+          <span class="ml-2">{{ __('Lombaires', 'ccv') }}</span>
+        </label>
+        <label>
+          <input type="radio" name="problem-principal" value="{{ __('Scoliose', 'ccv') }}">
+          <span class="ml-2">{{ __('Scoliose', 'ccv') }}</span>
+        </label>
+      </div>
+    </li>
+  </ul>
+</div>
+
+{{-- TREATMENTS --}}
+<div class="bg-white py-2v pl-4v pr-3v">
+  <h2>{{ __('2. Vos traitements réalisés') }}</h2>
+</div>
+
+{{-- IMAGERY --}}
+<div class="bg-light py-2v pl-4v pr-3v">
+  <h2>{{ __('3. Votre imagerie') }}</h2>
+</div>
+
+{{-- CONTACT DETAILS --}}
+<div class="bg-white py-2v pl-4v pr-3v">
+  <h2>{{ __('4. Vos informations') }}</h2>
+</div>