From: vincent@cubedesigners.com Date: Wed, 29 Jun 2016 16:07:09 +0000 (+0000) Subject: aditionnal refactoring on page intro | #509 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=32650f02b01deb4108c07a063d6b58d6aa1e70e9;p=fluidbook-v3.git aditionnal refactoring on page intro | #509 @0.25 --- diff --git a/framework/application/forms/CMS/Base.php b/framework/application/forms/CMS/Base.php new file mode 100644 index 0000000..6b6d8f7 --- /dev/null +++ b/framework/application/forms/CMS/Base.php @@ -0,0 +1,17 @@ +setLegend('Introduction'); + $this->addSubForm($intro, 'intro'); + } +} \ No newline at end of file diff --git a/framework/application/forms/CMS/Contact.php b/framework/application/forms/CMS/Contact.php index 25e28d0..48ec935 100644 --- a/framework/application/forms/CMS/Contact.php +++ b/framework/application/forms/CMS/Contact.php @@ -1,23 +1,9 @@ setLabel('Intro Titre'); - $intro_title->setAttrib('rows', 3); - $this->addElement($intro_title); - - $intro_content = new CubeIT_Form_Element_Markitup('intro_content'); - $intro_content->setLabel('Intro Content'); - $this->addElement($intro_content); - - $intro_bg = new CubeIT_Form_Element_File_Image('intro_bg_image'); - $intro_bg->setLabel('Background Image'); - $intro_bg->setMaxItems(1); - $this->addElement($intro_bg); } } \ No newline at end of file diff --git a/framework/application/forms/CMS/Sub/Intro.php b/framework/application/forms/CMS/Sub/Intro.php new file mode 100644 index 0000000..18f68be --- /dev/null +++ b/framework/application/forms/CMS/Sub/Intro.php @@ -0,0 +1,40 @@ +setLabel('Titre'); + $intro_title->setAttrib('rows', 3); + $this->addElement($intro_title); + + $intro_content = new CubeIT_Form_Element_Markitup('content'); + $intro_content->setLabel('Contenu'); + $this->addElement($intro_content); + + $button = new CubeIT_Form_Element_Link(); + $button->setLabel('Bouton'); + $this->addSubForm($button, 'button'); + + $color = new CubeIT_Form_Element_Color('bg_color'); + $color->setLabel('Couleur de fond'); + $color->setValue('#ffffff'); + $this->addElement($color); + + $intro_bg = new CubeIT_Form_Element_File_Image('bg_image'); + $intro_bg->setLabel('Image de fond'); + $intro_bg->setMaxItems(1); + $this->addElement($intro_bg); + + $chapo = new CubeIT_Form_Element_Markitup('chapo'); + $chapo->setLabel('Chapo'); + $this->addElement($chapo); + } +} \ No newline at end of file diff --git a/framework/application/views/helpers/IntroBlock.php b/framework/application/views/helpers/IntroBlock.php index 381402c..4b05ea0 100644 --- a/framework/application/views/helpers/IntroBlock.php +++ b/framework/application/views/helpers/IntroBlock.php @@ -2,39 +2,42 @@ class Fluidbook_View_Helper_IntroBlock extends CubeIT_View_Helper_Abstract { - public function introBlock($title, $content, $bg_image = null, $bg_color = null) { - - $style = ''; - $extra_attributes = ''; - - if ($bg_image) { - $image_path = CubeIT_View_Helper_ImageCms::getPath($bg_image); - - // Work out the ratio of the background image - CubeIT_Image::getDimensions($image_path, $image_width, $image_height); - $image_ratio = $image_height / $image_width; - - $style = "background-image: url($image_path);"; - $extra_attributes = 'data-bg-ratio="'. $image_ratio .'"'; - } - - if ($bg_color) { - $style .= "background-color: $bg_color"; - } - - - $res = '
'; - - $res .= '
'; - $res .= '
'; - - $res .= '

'. nl2br($title) .'

'; - $res .= $content; - - $res .= '
'; // .col-2 - $res .= '
'; // .grid - $res .= '
'; // .content-wrapper - - return $res; - } + public function introBlock($intro, $additionnalContent) { + + $style = ''; + $extra_attributes = ''; + + if ($intro['bg_image']) { + $image_path = CubeIT_View_Helper_ImageCms::getPath($intro['bg_image']); + + // Work out the ratio of the background image + CubeIT_Image::getDimensions($image_path, $image_width, $image_height); + $image_ratio = $image_height / $image_width; + + $style = "background-image: url($image_path);"; + $extra_attributes = 'data-bg-ratio="' . $image_ratio . '"'; + } + + if ($intro['bg_color']) { + $style .= "background-color:" . $intro['bg_color'] . ";"; + } + + + $res = '
'; + + $res .= '
'; + $res .= '
'; + + $res .= '

' . nl2br($intro['title']) . '

'; + $res .= $this->markupDotclear($intro['content']); + if ($additionnalContent) { + $res .= $additionnalContent; + } + + $res .= '
'; // .col-2 + $res .= '
'; // .grid + $res .= '
'; // .content-wrapper + + return $res; + } } \ No newline at end of file diff --git a/framework/application/views/scripts/templates/contact.phtml b/framework/application/views/scripts/templates/contact.phtml index 236bfce..28daf2c 100644 --- a/framework/application/views/scripts/templates/contact.phtml +++ b/framework/application/views/scripts/templates/contact.phtml @@ -2,53 +2,27 @@ $this->headScript()->addScriptAndStyle('310-contact'); -$intro_image_path = CubeIT_View_Helper_ImageCms::getPath($this->intro_bg_image); - -// Work out the ratio of the background image -CubeIT_Image::getDimensions($intro_image_path, $intro_image_width, $intro_image_height); -$intro_ratio = $intro_image_height / $intro_image_width; - -$res .= '
'; - -$res .= '
'; -$res .= '
'; - -$res .= '

'. nl2br($this->intro_title) .'

'; -$res .= $this->markupDotclear($this->intro_content); - -// Address $address = $this->option('address'); $locale = new Zend_Locale(); $country = strtoupper($locale->getTranslation($address['pays'], 'Territory')); -$res .= '
'; -$res .= '

'. $address['company'] .'

'; -$res .= $address['adresse']; -$res .= '
'; -$res .= "{$address['code_postal']} {$address['ville']} - $country"; -$res .= '
'; -$res .= __('Tél :') . ' ' . $this->linkPhone($address['phone']); -$res .= '
'; -$res .= __('email :') . ' ' . $this->linkEmail($address['email']); -$res .= '
'; - -$res .= '
'; // .col-2 -$res .= '
'; // .grid +$content = '
'; +$content .= '

'. $address['company'] .'

'; +$content .= $address['adresse']; +$content .= '
'; +$content .= "{$address['code_postal']} {$address['ville']} - $country"; +$content .= '
'; +$content .= __('Tél :') . ' ' . $this->linkPhone($address['phone']); +$content .= '
'; +$content .= __('email :') . ' ' . $this->linkEmail($address['email']); +$content .= '
'; + +$res = '
'; +$res .= $this->introBlock($this->intro, $content); $res .= '
'; // .contact-intro + // Request Quote form -$res .= '
'; -$res .= '
'; -$res .= '

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

'; -$res .= $this->markupDotclear($this->option('quote_description')); -$res .= '
'; // .col-2 -$res .= '
'; -$form = new Fluidbook_Form_RequestQuote(); -$res .= $form; -$res .= $this->markupDotclear($this->option('quote_form_tips')); -$res .= '
'; // .col-4 -$res .= '
'; // .request-quote +$res .= $this->quoteForm(); // Resellers