From: vincent@cubedesigners.com Date: Wed, 27 Jul 2016 10:46:40 +0000 (+0000) Subject: wip #493 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7f19d277ba6cd4f8182cb37664b20a73645b2273;p=fluidbook-v3.git wip #493 @1 --- diff --git a/framework/application/views/helpers/HomeIntro.php b/framework/application/views/helpers/HomeIntro.php index 6c9f170..e20d797 100644 --- a/framework/application/views/helpers/HomeIntro.php +++ b/framework/application/views/helpers/HomeIntro.php @@ -7,10 +7,10 @@ class Fluidbook_View_Helper_HomeIntro extends Fluidbook_View_Helper_HomeLayer { public function homeIntro($data) { $this->data = $data; - $res = $this->title($data['title']); - $res .= $this->markupDotclear($data['content']); - $res .= $this->linkCMS($data['button'], ['class' => 'btn', 'style' => 'background:'. $data['themecolor']]); + $res=$this->_leftText(); return $this->_layer($res, 'intro'); } + + } \ No newline at end of file diff --git a/framework/application/views/helpers/HomeLayer.php b/framework/application/views/helpers/HomeLayer.php index 47d97ff..782de74 100644 --- a/framework/application/views/helpers/HomeLayer.php +++ b/framework/application/views/helpers/HomeLayer.php @@ -3,17 +3,24 @@ class Fluidbook_View_Helper_HomeLayer extends CubeIT_View_Helper_Abstract { public $data; - protected function _layer($content, $class, $attributes = array()) { + protected function _layer($content, $class, $attributes = array(), $outerContent = '') { - $class .= ' section ' . $this->data['headerstyle']; + $class .= ' section ' . $this->data['headerstyle']; $defaultAttributes = array('class' => $class, 'data-headerstyle' => $this->data['headerstyle']); $attributes = $this->_mergeAttributes($attributes, $defaultAttributes); - $content = $this->htmlElement($content, 'div', array('class' => 'content-inner')); - + $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() { + $res = $this->title($this->data['title']); + $res .= $this->markupDotclear($this->data['content']); + $res .= $this->linkCMS($this->data['button'], ['class' => 'btn', 'style' => 'background:' . $this->data['themecolor']]); + return $res; + } } \ No newline at end of file diff --git a/framework/application/views/helpers/HomeReferences.php b/framework/application/views/helpers/HomeReferences.php index 52ffc0c..534f0aa 100644 --- a/framework/application/views/helpers/HomeReferences.php +++ b/framework/application/views/helpers/HomeReferences.php @@ -5,10 +5,42 @@ class Fluidbook_View_Helper_HomeReferences extends Fluidbook_View_Helper_HomeLay * @return string */ public function homeReferences($data) { - $this->data=$data; + $this->headScript()->addScriptAndStyle('215-home-references'); + $this->data = $data; + + $res = $this->_leftText(); + return $this->_layer($res, 'references', array(), $this->_references()); + } + + protected function _references() { + $fluidbooks = Fluidbook_Model_Reference::factory()->where('homeimage != ?', '')->order('date DESC')->limit(6)->find(); $res = ''; + $i = 0; + foreach ($fluidbooks as $fluidbook) { + $res .= $this->_reference($fluidbook, $i % 6 == 2 || $i % 6 == 3); + $i++; + } + return $this->htmlElement($res, 'div', array('class' => 'links')); + } + + /** + * @param $fluidbook Fluidbook_Model_Reference + * @return mixed + */ + protected function _reference($fluidbook, $big = false) { + $w = 1024; + $h = $w / 2; + if ($big) { + $h = $w; + } + $fluidbook = $fluidbook->unserialize(); + $res = $this->imageProcess($fluidbook->getHomeimage(), $fluidbook->getTitle(), $w, $h, array()); + $attributes = array('class' => array('reference')); + if ($big) { + $attributes['class'][] = 'big'; + } - return $this->_layer($res, 'references'); + return $this->htmlElement($res, 'div', $attributes); } } \ No newline at end of file diff --git a/js/210-home.js b/js/210-home.js index 28773c2..e50f467 100644 --- a/js/210-home.js +++ b/js/210-home.js @@ -47,6 +47,7 @@ function resizeHome() { resizeHomeContact(ww, wh); + resizeHomeReferences(ww,wh); } function resizeHomeContact(ww, wh) { diff --git a/js/215-home-references.js b/js/215-home-references.js new file mode 100644 index 0000000..0899fd4 --- /dev/null +++ b/js/215-home-references.js @@ -0,0 +1,28 @@ +registerLoader(load_home_references, true); + +function load_home_references() { + +} + +function resizeHomeReferences(ww, wh) { + var links = $("section.references .links"); + $(links).css({width: wh, height: wh}); + + var i = 0; + var x = 0; + var y = 0; + var u = wh / 2; + $(links).find('.reference').each(function () { + $(this).css({width: u, left: x, top: y}); + if ($(this).hasClass('big')) { + y += u; + } else { + y += u / 2; + } + i++; + if (i % 3 == 0) { + y = 0; + x += u; + } + }); +} \ No newline at end of file diff --git a/less/215-home-references.less b/less/215-home-references.less new file mode 100644 index 0000000..56fb08a --- /dev/null +++ b/less/215-home-references.less @@ -0,0 +1,23 @@ +@import "000-imports"; + +section.references { + position: relative; + .links { + position: absolute; + right: 0; + top: 0; + height: 100%; + overflow: hidden; + + .reference{ + display: block; + position: absolute; + } + + img { + width: 100%; + height: auto; + display: block; + } + } +} \ No newline at end of file