From 10eab9f23d48ade2f8c845913edb925bd5f70ec6 Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Wed, 29 Jun 2016 16:54:50 +0000 Subject: [PATCH] WIP #482 @5.5 --- .../controllers/AjaxController.php | 13 +++ framework/application/forms/RequestQuote.php | 16 +++- .../application/views/helpers/QuoteForm.php | 7 +- less/003-mixins.less | 14 +++- less/102-footer.less | 1 + less/310-contact.less | 7 -- less/315-quote.less | 82 +++++++++++++++++++ 7 files changed, 126 insertions(+), 14 deletions(-) create mode 100644 less/315-quote.less diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index 46730e3..dd23b5a 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -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 + } + + } } diff --git a/framework/application/forms/RequestQuote.php b/framework/application/forms/RequestQuote.php index 5c4aace..72c62df 100644 --- a/framework/application/forms/RequestQuote.php +++ b/framework/application/forms/RequestQuote.php @@ -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 .'
', $form); } + } \ No newline at end of file diff --git a/framework/application/views/helpers/QuoteForm.php b/framework/application/views/helpers/QuoteForm.php index 5104436..3a90793 100644 --- a/framework/application/views/helpers/QuoteForm.php +++ b/framework/application/views/helpers/QuoteForm.php @@ -3,7 +3,9 @@ class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract { public function quoteForm() { - + + $this->headScript()->addScriptAndStyle('315-quote'); + $res = '
'; $res .= '
'; $res .= '

'. nl2br($this->option('quote_heading')) .'

'; @@ -11,8 +13,7 @@ class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract { $res .= '
'; // .col-2 $res .= '
'; $form = new Fluidbook_Form_RequestQuote(); - $tips = $this->markupDotclear($this->option('quote_form_tips'), [], ['class' => 'tips']); - $res .= str_replace('', '
'. $tips .'
', $form); // Inject tips HTML into form via placeholder + $res .= $form; $res .= '
'; // .col-4 $res .= '
'; // .request-quote diff --git a/less/003-mixins.less b/less/003-mixins.less index 46a64cd..9946962 100644 --- a/less/003-mixins.less +++ b/less/003-mixins.less @@ -11,10 +11,18 @@ -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; } diff --git a/less/102-footer.less b/less/102-footer.less index 6e59638..f2f7c87 100644 --- a/less/102-footer.less +++ b/less/102-footer.less @@ -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; diff --git a/less/310-contact.less b/less/310-contact.less index 502d50d..6551b48 100644 --- a/less/310-contact.less +++ b/less/310-contact.less @@ -33,11 +33,4 @@ } } -} - -// 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 index 0000000..d114664 --- /dev/null +++ b/less/315-quote.less @@ -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 -- 2.39.5