]> _ Git - fluidbook-v3.git/commitdiff
WIP #482 @5.5
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 16:54:50 +0000 (16:54 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jun 2016 16:54:50 +0000 (16:54 +0000)
framework/application/controllers/AjaxController.php
framework/application/forms/RequestQuote.php
framework/application/views/helpers/QuoteForm.php
less/003-mixins.less
less/102-footer.less
less/310-contact.less
less/315-quote.less [new file with mode: 0644]

index 46730e38203050aaa06b6d9cc44a7d7ae6669fce..dd23b5aefe4842749c6494785619a319b3261ef9 100644 (file)
@@ -2,5 +2,18 @@
 
 class AjaxController extends CubeIT_Controller_AjaxController {
 
+    public function requestQuote() {
+
+        $form = new Fluidbook_Form_RequestQuote();
+
+        if ($form->isValid($_POST)) {
+
+            // ToDo: process form...
+
+        } else {
+            $this->_datas->refreshForm($form); // Respond with validation errors
+        }
+
+    }
 
 }
index 5c4aace56d586c3d701be946a204e10e14cb51d0..72c62dfe4ea25c9ef6cd0b8ef34fd37dd0de1d19 100644 (file)
@@ -13,7 +13,7 @@ class Fluidbook_Form_RequestQuote extends CubeIT_Form {
 
         $first_name = new Zend_Form_Element_Text('first_name');
         $first_name->setLabel(__('Prénom'));
-        $first_name->setRequired(true);
+        $first_name->setRequired(false);
         $first_name->addErrorMessage(__('Votre prénom est obligatoire'));
         $this->addElement($first_name);
 
@@ -63,6 +63,20 @@ class Fluidbook_Form_RequestQuote extends CubeIT_Form {
         $submit->setAttrib('type', 'submit');
         $this->addElement($submit);
 
+        $this->setId('requestQuote')
+            ->setAjax()
+            ->setAction('/ajax/requestQuote');
+
+    }
+
+    public function render(Zend_View_Interface $view = null) {
+
+        $form = parent::render($view);
+
+        // Inject tips HTML into form via placeholder
+        $tips = $this->getView()->markupDotclear($this->getView()->option('quote_form_tips'), [], ['class' => 'tips']);
+        return str_replace('<!-- TIPS -->', '<div id="wrap-tips">'. $tips .'</div>', $form);
     }
 
+
 }
\ No newline at end of file
index 510443670b53f077650e38cae8cb1236d2d2fac1..3a9079377d71f5cc5f1ddbbf85bb1be6336855aa 100644 (file)
@@ -3,7 +3,9 @@
 class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract {
 
     public function quoteForm() {
-        
+
+        $this->headScript()->addScriptAndStyle('315-quote');
+
         $res  = '<div class="request-quote content-wrapper grid">';
         $res .= '<div class="text col-2">';
         $res .= '<h1 class="title">'. nl2br($this->option('quote_heading')) .'</h1>';
@@ -11,8 +13,7 @@ class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract {
         $res .= '</div>'; // .col-2
         $res .= '<div class="form col-4">';
         $form = new Fluidbook_Form_RequestQuote();
-        $tips = $this->markupDotclear($this->option('quote_form_tips'), [], ['class' => 'tips']);
-        $res .= str_replace('<!-- TIPS -->', '<div id="wrap-tips">'. $tips .'</div>', $form); // Inject tips HTML into form via placeholder
+        $res .= $form;
         $res .= '</div>'; // .col-4
         $res .= '</div>'; // .request-quote
         
index 46a64cdaa91cb191dff0bb0dac7d0e85710ad8e6..99469621035dd22e216aa566a3d8886be2ebeeac 100644 (file)
        -moz-osx-font-smoothing: auto;
 }
 
-.rounded-button() {
+.button(@line-height: 54px, @horizontal-padding: 20px) {
        display: inline-block;
-       padding: 13px 29px 14px;
-       line-height: 9px;
+       line-height: @line-height;
+       padding-left: @horizontal-padding;
+       padding-right: @horizontal-padding;
+       border: 0;
+       font-weight: 300;
+       text-transform: uppercase;
+}
+
+.rounded-button() {
+       .button(35px, 29px);
        border-radius: 19px;
        border: 1px solid transparent;
 }
index 6e596387fb4d99bb938618a72fdbd5aec43d1a6e..f2f7c87ba0dc9b7bf368976b95b067e1008ee04b 100644 (file)
@@ -74,6 +74,7 @@ footer.site {
   .workshop-link {
     .rounded-button();
     .border-button(#fff, #fff);
+    line-height: 1;
     padding: 20px 65px;
     border-radius: 26px;
     text-transform: uppercase;
index 502d50d9575e792a31959465ff06f50259f36d91..6551b487af6e29308e8d6063d11bd02cb166322c 100644 (file)
     }
   }
 
-}
-
-// Request a quote section
-.request-quote {
-  .text {
-    padding-right: 30px;
-  }
 }
\ No newline at end of file
diff --git a/less/315-quote.less b/less/315-quote.less
new file mode 100644 (file)
index 0000000..d114664
--- /dev/null
@@ -0,0 +1,82 @@
+@import "000-imports";
+
+// Request a quote section
+.request-quote {
+  .text {
+    padding-right: 30px;
+  }
+
+  .zend_form {
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-between;
+    margin: 0 -14px; // Offset child padding on edges
+
+    > div {
+      flex-basis: 50%;
+      padding: 0 14px; // To create a 28px gap between cells
+    }
+  }
+
+  label {
+    display: block;
+    margin-bottom: 8px;
+    font-size: 15px;
+  }
+
+  input[type="text"], input[type="email"], textarea, select {
+    border: 1px solid @color-text;
+    line-height: 53px;
+    padding: 0 15px;
+    -webkit-appearance: none;
+    -moz-appearance: none;
+    appearance: none;
+    border-radius: 0;
+  }
+
+  textarea {
+    line-height: 1.3;
+    padding: 15px;
+    height: 170px;
+    display: block; // Removes space below element caused by inline-block
+  }
+
+  #wrap-tips {
+    align-self: center;
+    margin-bottom: 10px;
+  }
+
+  .tips {
+    margin-top: 42px;
+    padding: 20px 30px;
+    background-color: #f3f3f3;
+    min-height: 170px; // Same as textarea height
+    position: relative;
+
+    // < arrow
+    &:after {
+      right: 100%;
+      top: 50%;
+      content: '';
+      height: 0;
+      width: 0;
+      position: absolute;
+      pointer-events: none;
+      border: 16px solid transparent;
+      border-right-color: #f3f3f3;
+      margin-top: -16px;
+    }
+  }
+
+  #submit-element {
+    margin: 14px;
+
+    button {
+      .button();
+      color: #fff;
+      background-color: @color-green;
+      font-size: 14px;
+    }
+  }
+
+}
\ No newline at end of file