]> _ Git - fluidbook-v3.git/commitdiff
wip #493 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 27 Jul 2016 10:46:40 +0000 (10:46 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 27 Jul 2016 10:46:40 +0000 (10:46 +0000)
framework/application/views/helpers/HomeIntro.php
framework/application/views/helpers/HomeLayer.php
framework/application/views/helpers/HomeReferences.php
js/210-home.js
js/215-home-references.js [new file with mode: 0644]
less/215-home-references.less [new file with mode: 0644]

index 6c9f17085722e738961c7319d21744fd34ada350..e20d797a86819ded2b9443aa00694fcf53d9479f 100644 (file)
@@ -7,10 +7,10 @@ class Fluidbook_View_Helper_HomeIntro extends Fluidbook_View_Helper_HomeLayer {
        public function homeIntro($data) {\r
                $this->data = $data;\r
 \r
-        $res  = $this->title($data['title']);\r
-        $res .= $this->markupDotclear($data['content']);\r
-        $res .= $this->linkCMS($data['button'], ['class' => 'btn', 'style' => 'background:'. $data['themecolor']]);\r
+        $res=$this->_leftText();\r
 \r
                return $this->_layer($res, 'intro');\r
        }\r
+\r
+\r
 }
\ No newline at end of file
index 47d97ffdc90a5e20a801d892b1e2d73a0fcd6d11..782de74ef76bdfd458bc9cdebff1a5290d8a35aa 100644 (file)
@@ -3,17 +3,24 @@
 class Fluidbook_View_Helper_HomeLayer extends CubeIT_View_Helper_Abstract {\r
        public $data;\r
 \r
-       protected function _layer($content, $class, $attributes = array()) {\r
+       protected function _layer($content, $class, $attributes = array(), $outerContent = '') {\r
 \r
-           $class .= ' section ' . $this->data['headerstyle'];\r
+               $class .= ' section ' . $this->data['headerstyle'];\r
 \r
                $defaultAttributes = array('class' => $class, 'data-headerstyle' => $this->data['headerstyle']);\r
                $attributes = $this->_mergeAttributes($attributes, $defaultAttributes);\r
 \r
-        $content = $this->htmlElement($content, 'div', array('class' => 'content-inner'));\r
-\r
+               $content = $this->htmlElement($content, 'div', array('class' => 'content-inner'));\r
+               $content .= $outerContent;\r
                $content = $this->backgroundBlock($content, $this->data, array('content-wrapper', 'no-shrink', 'fullheight'));\r
 \r
                return $this->htmlElement($content, 'section', $attributes);\r
        }\r
+\r
+       protected function _leftText() {\r
+               $res = $this->title($this->data['title']);\r
+               $res .= $this->markupDotclear($this->data['content']);\r
+               $res .= $this->linkCMS($this->data['button'], ['class' => 'btn', 'style' => 'background:' . $this->data['themecolor']]);\r
+               return $res;\r
+       }\r
 }
\ No newline at end of file
index 52ffc0c29037353a3bd13f3b8a1a56ba76e89c84..534f0aaba08407e134ccab95d81bb75361c10740 100644 (file)
@@ -5,10 +5,42 @@ class Fluidbook_View_Helper_HomeReferences extends Fluidbook_View_Helper_HomeLay
         * @return string\r
         */\r
        public function homeReferences($data) {\r
-               $this->data=$data;\r
+               $this->headScript()->addScriptAndStyle('215-home-references');\r
 \r
+               $this->data = $data;\r
+\r
+               $res = $this->_leftText();\r
+               return $this->_layer($res, 'references', array(), $this->_references());\r
+       }\r
+\r
+       protected function _references() {\r
+               $fluidbooks = Fluidbook_Model_Reference::factory()->where('homeimage != ?', '')->order('date DESC')->limit(6)->find();\r
                $res = '';\r
+               $i = 0;\r
+               foreach ($fluidbooks as $fluidbook) {\r
+                       $res .= $this->_reference($fluidbook, $i % 6 == 2 || $i % 6 == 3);\r
+                       $i++;\r
+               }\r
+               return $this->htmlElement($res, 'div', array('class' => 'links'));\r
+       }\r
+\r
+       /**\r
+        * @param $fluidbook Fluidbook_Model_Reference\r
+        * @return mixed\r
+        */\r
+       protected function _reference($fluidbook, $big = false) {\r
+               $w = 1024;\r
+               $h = $w / 2;\r
+               if ($big) {\r
+                       $h = $w;\r
+               }\r
+               $fluidbook = $fluidbook->unserialize();\r
+               $res = $this->imageProcess($fluidbook->getHomeimage(), $fluidbook->getTitle(), $w, $h, array());\r
+               $attributes = array('class' => array('reference'));\r
+               if ($big) {\r
+                       $attributes['class'][] = 'big';\r
+               }\r
 \r
-               return $this->_layer($res, 'references');\r
+               return $this->htmlElement($res, 'div', $attributes);\r
        }\r
 }
\ No newline at end of file
index 28773c25a183e6dcae25f163648041de4c9bd52a..e50f4674109760311bf5bb3630eea96d8d8fb1c6 100644 (file)
@@ -47,6 +47,7 @@ function resizeHome() {
 \r
 \r
     resizeHomeContact(ww, wh);\r
+    resizeHomeReferences(ww,wh);\r
 }\r
 \r
 function resizeHomeContact(ww, wh) {\r
diff --git a/js/215-home-references.js b/js/215-home-references.js
new file mode 100644 (file)
index 0000000..0899fd4
--- /dev/null
@@ -0,0 +1,28 @@
+registerLoader(load_home_references, true);\r
+\r
+function load_home_references() {\r
+\r
+}\r
+\r
+function resizeHomeReferences(ww, wh) {\r
+    var links = $("section.references .links");\r
+    $(links).css({width: wh, height: wh});\r
+\r
+    var i = 0;\r
+    var x = 0;\r
+    var y = 0;\r
+    var u = wh / 2;\r
+    $(links).find('.reference').each(function () {\r
+        $(this).css({width: u, left: x, top: y});\r
+        if ($(this).hasClass('big')) {\r
+            y += u;\r
+        } else {\r
+            y += u / 2;\r
+        }\r
+        i++;\r
+        if (i % 3 == 0) {\r
+            y = 0;\r
+            x += u;\r
+        }\r
+    });\r
+}
\ No newline at end of file
diff --git a/less/215-home-references.less b/less/215-home-references.less
new file mode 100644 (file)
index 0000000..56fb08a
--- /dev/null
@@ -0,0 +1,23 @@
+@import "000-imports";\r
+\r
+section.references {\r
+       position: relative;\r
+       .links {\r
+               position: absolute;\r
+               right: 0;\r
+               top: 0;\r
+               height: 100%;\r
+               overflow: hidden;\r
+\r
+               .reference{\r
+                       display: block;\r
+                       position: absolute;\r
+               }\r
+\r
+               img {\r
+                       width: 100%;\r
+                       height: auto;\r
+                       display: block;\r
+               }\r
+       }\r
+}
\ No newline at end of file