From: vincent@cubedesigners.com Date: Thu, 19 Dec 2019 11:52:44 +0000 (+0000) Subject: wait #3282 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2eddfb421d28186ed3e7b8bbb52416e458025e22;p=fluidbook-v3.git wait #3282 @0.75 --- diff --git a/framework/application/views/helpers/BackgroundBlock.php b/framework/application/views/helpers/BackgroundBlock.php index 1bbd15e..78e49a2 100644 --- a/framework/application/views/helpers/BackgroundBlock.php +++ b/framework/application/views/helpers/BackgroundBlock.php @@ -1,62 +1,81 @@ $class); +class Fluidbook_View_Helper_BackgroundBlock extends CubeIT_View_Helper_Abstract +{ + /** + * @return string + */ + public function backgroundBlock($content, $data, $class = array('content-wrapper', 'no-shrink')) + { + $style = ''; + $attributes = array('class' => $class); - if (isset($data['backgroundimage']) && !isset($data['bg_image'])) { - $data['bg_image'] = $data['backgroundimage']; - } - if (isset($data['backgroundcolor']) && !isset($data['bg_color'])) { - $data['bg_color'] = $data['backgroundcolor']; - } - if (isset($data['bg_image'])) { - $bgimage = CubeIT_Util_Cms::extractFile($data['bg_image']); - $extra_attributes = array(); - if ($bgimage) { - $image_path = CubeIT_View_Helper_ImageCms::getPath($bgimage); + if (isset($data['backgroundimage']) && !isset($data['bg_image'])) { + $data['bg_image'] = $data['backgroundimage']; + } + if (isset($data['backgroundcolor']) && !isset($data['bg_color'])) { + $data['bg_color'] = $data['backgroundcolor']; + } + if (isset($data['bg_image'])) { + $bgimage = CubeIT_Util_Cms::extractFile($data['bg_image']); + $extra_attributes = array(); + if ($bgimage) { + $image_path = CubeIT_View_Helper_ImageCms::getPath($bgimage); - // Work out the ratio of the background image - CubeIT_Image::getDimensions($image_path, $image_width, $image_height); - $image_ratio = $image_height / $image_width; - $attributes['data-bg-ratio'] = $image_ratio; + // Work out the ratio of the background image + CubeIT_Image::getDimensions($image_path, $image_width, $image_height); + $image_ratio = $image_height / $image_width; + $attributes['data-bg-ratio'] = $image_ratio; - // Create a cropped version of the image for mobile that cuts off the left 45% of the image + // Create a cropped version of the image for mobile that cuts off the left 45% of the image // Make sure image is not wider than 900px when finished $mobile_max_width = 900; // Scale image, factoring in crop that will take place... // Image will be cropped to 900px wide so ensure that we have 45% extra and then determine the target height $target_height = ($mobile_max_width / 0.55) * $image_ratio; //$mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $image_width * 0.55, $image_height, array(), 'C', 'R', 'M'); - $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + if (isset($data['backgroundmobileimage'])) { + $bgmobileimage = CubeIT_Util_Cms::extractFile($data['backgroundmobileimage']); + if ($bgmobileimage) { + $attributes['data-has-mobile']='1'; + $mobile_path = CubeIT_View_Helper_ImageCms::getPath($bgmobileimage); + CubeIT_Image::getDimensions($mobile_path, $image_width, $image_height); + $image_ratio = $image_height / $image_width; + $attributes['data-mobile-ratio'] = $image_ratio; + $target_height = $mobile_max_width * $image_ratio; + $mobile = $this->imageProcess()->imageProcessGetURL($mobile_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + }else{ + $attributes['data-bg-ratio'] = $attributes['data-bg-ratio']; + $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + } + } else { + $attributes['data-bg-ratio'] = $attributes['data-bg-ratio']; + $mobile = $this->imageProcess()->imageProcessGetURL($image_path, '', $mobile_max_width, $target_height, array(), 'C', 'R', 'M'); + } - $bg = $this->htmlElement($this->picture([ - [ - 'src' => $image_path, - 'width' => 1680 + $bg = $this->htmlElement($this->picture([ + [ + 'src' => $image_path, + 'width' => 1920 ], [ 'src' => $mobile, - 'width' => 900, + 'width' => $mobile_max_width, 'media' => '(max-width: 900px)' ] ], - [ - 'alt' => $data['title'] - ]), 'div', array('class' => 'picture')); - $content = $bg . $content; - } - } + [ + 'alt' => $data['title'] + ]), 'div', array('class' => 'picture')); + $content = $bg . $content; + } + } - if (isset($data['bg_color'])) { - $style .= "background-color:" . $data['bg_color'] . ";"; - } - $attributes['style'] = $style; + if (isset($data['bg_color'])) { + $style .= "background-color:" . $data['bg_color'] . ";"; + } + $attributes['style'] = $style; - return $this->htmlElement($content, 'div', $attributes); - } + return $this->htmlElement($content, 'div', $attributes); + } } diff --git a/framework/application/views/helpers/HomeLayer.php b/framework/application/views/helpers/HomeLayer.php index d46f636..2add350 100644 --- a/framework/application/views/helpers/HomeLayer.php +++ b/framework/application/views/helpers/HomeLayer.php @@ -1,31 +1,35 @@ data['headerstyle']; - - $defaultAttributes = array('class' => $class, - 'data-headerstyle' => $this->data['headerstyle'], - 'data-themecolor' => $this->data['themecolor'], - 'data-section-name' => $section, 'data-puce' => $this->data['puce']); - $attributes = $this->_mergeAttributes($attributes, $defaultAttributes); - - $content = $this->htmlElement($content, 'div', array('class' => 'content-inner')); - $content .= $outerContent; - $content = $this->backgroundBlock($content, $this->data, array('content-wrapper', 'no-shrink', 'fullheight')); - - return $this->htmlElement($content, 'section', $attributes); - } - - protected function _leftText($title_element = 'h2') { - $res = $this->title($this->data['title'], $title_element); - $res .= $this->markupDotclear($this->data['content']); - $res .= $this->linkCMS($this->data['button'], ['class' => 'btn', 'style' => 'background:' . $this->data['themecolor']]); - return $res; - } +class Fluidbook_View_Helper_HomeLayer extends CubeIT_View_Helper_Abstract +{ + public $data; + + protected function _layer($content, $class, $attributes = array(), $outerContent = '') + { + + $section = $class; + + $class .= ' section ' . $this->data['headerstyle']; + + $defaultAttributes = array('class' => $class, + 'data-headerstyle' => $this->data['headerstyle'], + 'data-themecolor' => $this->data['themecolor'], + 'data-has-mobile' => isset($this->data['backgroundmobileimage']), + 'data-section-name' => $section, 'data-puce' => $this->data['puce']); + $attributes = $this->_mergeAttributes($attributes, $defaultAttributes); + + $content = $this->htmlElement($content, 'div', array('class' => 'content-inner')); + $content .= $outerContent; + $content = $this->backgroundBlock($content, $this->data, array('content-wrapper', 'no-shrink', 'fullheight')); + + return $this->htmlElement($content, 'section', $attributes); + } + + protected function _leftText($title_element = 'h2') + { + $res = $this->title($this->data['title'], $title_element); + $res .= $this->markupDotclear($this->data['content']); + $res .= $this->linkCMS($this->data['button'], ['class' => 'btn', 'style' => 'background:' . $this->data['themecolor']]); + return $res; + } } diff --git a/framework/application/views/helpers/IntroBlock.php b/framework/application/views/helpers/IntroBlock.php index 250f968..440973e 100644 --- a/framework/application/views/helpers/IntroBlock.php +++ b/framework/application/views/helpers/IntroBlock.php @@ -1,84 +1,87 @@ addScriptAndStyle('102-intro'); - - - $res = '
'; - $res .= '
'; - $res .= $this->title($intro['title']); - $res .= $this->_content($intro['content']); - if ($additionnalContent) { - $res .= $additionnalContent; - } - - $res .= '
'; // .col-2 - $res .= '
'; // .grid - - $attrs = array('class' => array('intro')); - - if ($outsideContent) { - $res .= $outsideContent; - } - - if (isset($intro['backgroundimage']) && !isset($intro['bg_image'])) { - $intro['bg_image'] = $intro['backgroundimage']; - } - if (!isset($intro['bg_image']) || !$intro['bg_image']) { - $attrs['class'][] = 'nobg'; - } else { - $attrs['data-bg'] = print_r($intro['bg_image'], true); - } - - $res = $this->backgroundBlock($res, $intro); - if ($intro['chapo']) { - $res .= $this->htmlElement($this->htmlElement(nl2br($intro['chapo']), 'div'), 'blockquote'); - } - - - if (!$paddingTop) { - $attrs['class'][] = 'nopad'; - } - - if ($intro['header_theme']) { - $attrs['data-header-theme'] = 'light'; - } - - $style = ''; - if ($intro['text_color']) { - $s = '@color:' . $intro['text_color'] . ' ;'; - $s .= '.intro{' . "\n"; - $s .= 'h1,h2,h3,h4,h5,h6,b,strong,i,em,p,a,address{color:@color !important;}' . "\n"; - $s .= 'h1.title,h2.title,hr{&:after{background-color:@color !important;}}' . "\n"; - $s .= '}'; - $style = $this->styleLess($s); - } - - return $style . $this->htmlElement($res, 'section', $attrs); - } - - protected function _content($c) { - - $res = $this->markupDotclear($c); - if (stristr($res, '$adresse')) { - $address = $this->option('address'); - $locale = new Zend_Locale(); - $country = strtoupper($locale->getTranslation($address['pays'], 'Territory')); - $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 = str_replace('$adresse', $content, $res); - } - return $res; - } +class Fluidbook_View_Helper_IntroBlock extends CubeIT_View_Helper_Abstract +{ + + public function introBlock($intro, $additionnalContent = '', $outsideContent = '', $paddingTop = true) + { + $this->addScriptAndStyle('102-intro'); + + + $res = '
'; + $res .= '
'; + $res .= $this->title($intro['title']); + $res .= $this->_content($intro['content']); + if ($additionnalContent) { + $res .= $additionnalContent; + } + + $res .= '
'; // .col-2 + $res .= '
'; // .grid + + $attrs = array('class' => array('intro')); + + if ($outsideContent) { + $res .= $outsideContent; + } + + if (isset($intro['backgroundimage']) && !isset($intro['bg_image'])) { + $intro['bg_image'] = $intro['backgroundimage']; + } + if (!isset($intro['bg_image']) || !$intro['bg_image']) { + $attrs['class'][] = 'nobg'; + } else { + $attrs['data-bg'] = print_r($intro['bg_image'], true); + } + + $res = $this->backgroundBlock($res, $intro); + if ($intro['chapo']) { + $res .= $this->htmlElement($this->htmlElement(nl2br($intro['chapo']), 'div'), 'blockquote'); + } + + + if (!$paddingTop) { + $attrs['class'][] = 'nopad'; + } + + if ($intro['header_theme']) { + $attrs['data-header-theme'] = 'light'; + } + + $style = ''; + if ($intro['text_color']) { + $s = '@color:' . $intro['text_color'] . ' ;'; + $s .= '.intro{' . "\n"; + $s .= 'h1,h2,h3,h4,h5,h6,b,strong,i,em,p,a,address{color:@color !important;}' . "\n"; + $s .= 'h1.title,h2.title,hr{&:after{background-color:@color !important;}}' . "\n"; + $s .= '}'; + $style = $this->styleLess($s); + } + + return $style . $this->htmlElement($res, 'section', $attrs); + } + + protected function _content($c) + { + + $res = $this->markupDotclear($c); + if (stristr($res, '$adresse')) { + $address = $this->option('address'); + $locale = new Zend_Locale(); + $country = strtoupper($locale->getTranslation($address['pays'], 'Territory')); + $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 = str_replace('$adresse', $content, $res); + } + return $res; + } } \ No newline at end of file diff --git a/less/210-home.less b/less/210-home.less index a710719..85c7928 100644 --- a/less/210-home.less +++ b/less/210-home.less @@ -1,121 +1,136 @@ @import "000-imports"; .home { - .content-wrapper.fullheight { - position: relative; - background-position: bottom right; - - @media @m900 { - background-size: 180%; - } - } - - .content-inner { - position: absolute; - padding: 0 5%; - top: 50%; - left: 0; - width: 100%; - transform: translateY(-50%); - - @media @m900 { - position: relative; - transform: none; - padding-top: 5%; - padding-bottom: 80%; - text-align: center; - } - } - - .btn { - .button(); - .longarrow-button(16px, 40px, 18px); - color: #fff; - margin-top: 30px; - } - - section { - overflow: hidden; - - &.light { - color: #fff; - - .title { - color: #fff; - - &:after { - background-color: #fff; - } - } - } - - .dotclear { - max-width: 500px; - - @media @m900 { - max-width: none; - - ul { - display: inline-block; - text-align: left; - } - } - } - } + .content-wrapper.fullheight { + position: relative; + background-position: bottom right; + + @media @m900 { + background-size: 180%; + } + + &[data-has-mobile="1"] .content-inner { + @media @m900 { + padding-bottom: 55%; + } + } + } + + .content-inner { + position: absolute; + padding: 0 5%; + top: 50%; + left: 0; + width: 100%; + transform: translateY(-50%); + + @media @m900 { + position: relative; + transform: none; + padding-top: 5%; + padding-bottom: 80%; + text-align: center; + + + } + + + } + + .btn { + .button(); + .longarrow-button(16px, 40px, 18px); + color: #fff; + margin-top: 30px; + } + + section { + overflow: hidden; + + &.light { + color: #fff; + + .title { + color: #fff; + + &:after { + background-color: #fff; + } + } + } + + .dotclear { + max-width: 500px; + + @media @m900 { + max-width: none; + + ul { + display: inline-block; + text-align: left; + } + } + } + } } .pagination { - position: fixed; - top: 50%; - left: 15px; - transform: translateY(-50%); - font-size: 30px; - line-height: 1; - transition: opacity 0.3s; - cursor: pointer; - z-index: 10; - display: none; // Displayed only when in pagination mode - list-style: none; - - .fullpages & { - display: block; - } - - li { - //margin: 10px 0; - height: 22px; - position: relative; - padding: 0 10px 0 25px; - &:before { - content: ""; - background-color: #e1e2e3; - display: block; - width: 10px; - height: 10px; - border-radius: 5px; - position: absolute; - left: 6px; - top: 6px; - } - &:hover { - &:before { - background-color: #fff !important; - } - border-radius: 10px; - span { - position: relative; - display: inline-block; - color: #fff; - top: -10px; - } - } - span { - font-size: 14px; - line-height: 22px; - } - } - - span { - display: none; - } + position: fixed; + top: 50%; + left: 15px; + transform: translateY(-50%); + font-size: 30px; + line-height: 1; + transition: opacity 0.3s; + cursor: pointer; + z-index: 10; + display: none; // Displayed only when in pagination mode + list-style: none; + + .fullpages & { + display: block; + } + + li { + //margin: 10px 0; + height: 22px; + position: relative; + padding: 0 10px 0 25px; + + &:before { + content: ""; + background-color: #e1e2e3; + display: block; + width: 10px; + height: 10px; + border-radius: 5px; + position: absolute; + left: 6px; + top: 6px; + } + + &:hover { + &:before { + background-color: #fff !important; + } + + border-radius: 10px; + + span { + position: relative; + display: inline-block; + color: #fff; + top: -10px; + } + } + + span { + font-size: 14px; + line-height: 22px; + } + } + + span { + display: none; + } } \ No newline at end of file