<?php\r
\r
class Fluidbook_View_Helper_Exemples extends CubeIT_View_Helper_Abstract {\r
+\r
+ protected $_categories;\r
+ protected $_j = 0;\r
+\r
/**\r
* @return string\r
*/\r
$this->headScript()->addScriptAndStyle('220-exemples');\r
\r
$exemples = Fluidbook_Model_Reference::factory()->order('date DESC')->find();\r
+ $this->_categories = Fluidbook_Model_Reference_Category::factory()->find();\r
\r
$max_featured = floor($nb / 5);\r
$normal_per_featured = 4;\r
$publications = '';\r
for ($i = 0; $i < $max_featured; $i++) {\r
if ($i % 2 == 0) {\r
- $publications .= $this->_publication($exemples[$featured[$i]], true);\r
+ $publications .= $this->_publication($exemples[$featured[$i]], $category, $i * 4, true);\r
}\r
for ($j = 0; $j < $normal_per_featured; $j++) {\r
$k = ($i * $normal_per_featured) + $j;\r
if ($j == 2 && $i % 2 == 1) {\r
- $publications .= $this->_publication($exemples[$featured[$i]], true);\r
+ $publications .= $this->_publication($exemples[$featured[$i]], $category, $i * 4, true);\r
} else if ($j == 2 && $i % 2 == 0) {\r
- $publications .= $this->link('', '#', array('class' => 'empty'));\r
+ $publications .= $this->htmlElement('', 'article', array('class' => 'empty'));\r
}\r
- $publications .= $this->_publication($exemples[$normal[$k]], false);\r
+ $publications .= $this->_publication($exemples[$normal[$k]], $category, ($i * 4) + $j, false);\r
}\r
\r
}\r
* @param $f Fluidbook_Model_Reference\r
* @param bool $featured\r
*/\r
- protected function _publication($f, $featured = false) {\r
+ protected function _publication($f, $category, $i, $featured = false) {\r
if (null === $f) {\r
return;\r
}\r
$f = $f->unserialize();\r
\r
$res = '';\r
- $res .= $this->htmlElement(__('Voir le Fluidbook'), 'button', array('type' => 'button'));\r
+\r
$res .= $this->htmlElement($f->getTitle(), 'h3');\r
if ($featured) {\r
$res .= $this->htmlElement($f->getText(), 'p');\r
}\r
\r
+\r
$image = CubeIT_Util_Cms::extractFile($f->getImage());\r
\r
if (!$image && $f->getFluidbookId()) {\r
'class' => 'img')\r
);\r
}\r
- $attrs = array();\r
+ $attrs = array('data-j' => ++$this->_j, 'data-i' => $i);\r
if ($featured) {\r
$attrs['class'] = 'featured';\r
}\r
\r
- return $this->link($res, $f->getUrl(), $attrs);\r
+ $res .= $this->_rollover($f, $category);\r
+ return $this->htmlElement($res, 'article', $attrs);\r
+ }\r
+\r
+ protected function _rollover($f, $category) {\r
+ $res = '';\r
+ if ($f->getUrl()) {\r
+ $res = $this->link(__('Voir le Fluidbook'), $f->getUrl(), array('class' => 'button'));\r
+ }\r
+ if ($category == 3) {\r
+ $firstCat = 0;\r
+ foreach ($f->getCategories() as $c) {\r
+ if ($c == 3) {\r
+ continue;\r
+ }\r
+ $firstCat = $c;\r
+ break;\r
+ }\r
+ if ($firstCat != 0 && isset($this->_categories[$firstCat])) {\r
+ $cat = $this->_categories[$firstCat]->unserialize();\r
+ $pages = CubeIT_Util_Cms::findPagesByContent('category', $cat->getId());\r
+ shuffle($pages);\r
+\r
+ if (count($pages) > 0) {\r
+ $res .= $this->link($cat->getLinklabel(), 'internal:' . $pages[0], array('class' => 'others'));\r
+ }\r
+ }\r
+\r
+ }\r
+ return $this->htmlElement($res, 'div', array('class' => 'more'));\r
}\r
}
\ No newline at end of file
resizeExemples();\r
\r
$(".publications").masonry({\r
- itemSelector: "a",\r
+ itemSelector: "article",\r
fitWidth: true,\r
- columnWidth: "a:not(.featured)",\r
+ columnWidth: "article:not(.featured)",\r
transitionDuration: 0,\r
});\r
\r
var ww = $('main').width() * 0.9;\r
\r
$(".publications").css('width', ww);\r
- $('.publications a.featured').css({width: (ww / 2), height: ww / 2});\r
- $('.publications a:not(.featured)').css({width: (ww / 4), height: ww / 4});\r
+ $('.publications article.featured').css({width: (ww / 2), height: ww / 2});\r
+ $('.publications article:not(.featured)').css({width: (ww / 4), height: ww / 4});\r
$(".publications").masonry({\r
- itemSelector: "a",\r
+ itemSelector: "article",\r
});\r
\r
\r
var w = parseInt($(this).data('width'));\r
var h = parseInt($(this).data('height'));\r
\r
- var container = $(this).closest('a');\r
+ var container = $(this).closest('article');\r
var cw = $(container).outerWidth() * 0.8;\r
var ch = $(container).outerHeight() * 0.6;\r
\r
\r
.exemples {\r
.publications {\r
- a {\r
+ article {\r
&.empty {\r
display: none;\r
width: 0 !important;\r
\r
font-family: @opensans;\r
font-size: 14px;\r
- position: relative;\r
color: #343c44;\r
\r
.img {\r
margin-bottom: 12px;\r
}\r
\r
+ p, h3 {\r
+ position: relative;\r
+ z-index: 4;\r
+ }\r
+\r
&:nth-of-type(even) {\r
background-color: #fff;\r
}\r
background-color: @color-light-grey;\r
}\r
\r
- button {\r
+ .button {\r
background-color: transparent;\r
color: #343c44;\r
border: 0;\r
font-family: @montserrat;\r
font-weight: 300;\r
font-size: 12px;\r
- float: right;\r
line-height: 18px;\r
- margin-bottom: 50px;\r
cursor: pointer;\r
transition: @transition-time-buttons color;\r
- &:hover {\r
- color: @color-green;\r
- }\r
+ float: none;\r
+\r
+ margin-top: -27px;\r
+ display: inline-block;\r
+\r
+ .border-button-fill(#fff, rgba(231, 92, 123, 1));\r
+ .longarrow-button(20px, 40px, 18px);\r
}\r
\r
&.featured {\r
img {\r
height: auto;\r
}\r
- button {\r
- margin-left: 20px;\r
- margin-top: 5px;\r
- .border-button-fill(#fff, rgba(231, 92, 123, 1));\r
- .longarrow-button(20px, 40px, 18px);\r
+\r
+ .more {\r
+ padding-top: 50%;\r
+ }\r
+ }\r
+\r
+ .more {\r
+ display: none;\r
+ position: absolute;\r
+ width: 100%;\r
+ height: 100%;\r
+ top: 0;\r
+ left: 0;\r
+ background-color: rgba(52, 60, 68, .8);\r
+ color: #fff;\r
+ z-index: 3;\r
+ text-align: center;\r
+ padding-top: 45%;\r
+ a.others {\r
+ display: block;\r
+ color: #fff;\r
+ text-transform: uppercase;\r
+ font-family: @montserrat;\r
+ font-size: 12px;\r
+ font-weight: 300;\r
+ margin-top: 35px;\r
+ text-decoration: none;\r
+ }\r
+ }\r
+\r
+ &:hover {\r
+ .more {\r
+ display: block;\r
+ }\r
+ p, h3 {\r
+ color: #ffffff;\r
}\r
}\r
}\r