From aa28ea60b24f3d951b1775867f32b75336ac3fd2 Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Tue, 26 Jul 2016 16:40:18 +0000 Subject: [PATCH] WIP #4 @9 --- .../application/forms/CMS/Sub/Home/Block.php | 5 +- .../application/views/helpers/HomeLayer.php | 4 +- .../views/scripts/common/content.phtml | 4 +- .../views/scripts/common/footer.phtml | 4 +- .../views/scripts/templates/home.phtml | 6 +-- js/101-header.js | 2 +- js/210-home.js | 52 ++++++++++++++----- 7 files changed, 53 insertions(+), 24 deletions(-) diff --git a/framework/application/forms/CMS/Sub/Home/Block.php b/framework/application/forms/CMS/Sub/Home/Block.php index e7c9f8e..bfda0de 100644 --- a/framework/application/forms/CMS/Sub/Home/Block.php +++ b/framework/application/forms/CMS/Sub/Home/Block.php @@ -4,12 +4,13 @@ class Fluidbook_Form_CMS_Sub_Home_Block extends CubeIT_Form_SubForm { public function init() { parent::init(); - $title = new Zend_Form_Element_Text('title'); + $title = new Zend_Form_Element_Textarea('title'); + $title->setAttrib('rows', 2); $title->setLabel('Titre'); $title->setOrder(10); $this->addElement($title); - $text = new CubeIT_Form_Element_Markitup("text"); + $text = new CubeIT_Form_Element_Markitup('content'); $text->setLabel('Texte'); $text->setAttrib('rows', 8); $text->setOrder(20); diff --git a/framework/application/views/helpers/HomeLayer.php b/framework/application/views/helpers/HomeLayer.php index 30a1a2a..47d97ff 100644 --- a/framework/application/views/helpers/HomeLayer.php +++ b/framework/application/views/helpers/HomeLayer.php @@ -5,11 +5,13 @@ class Fluidbook_View_Helper_HomeLayer extends CubeIT_View_Helper_Abstract { protected function _layer($content, $class, $attributes = array()) { - $class .= ' section'; + $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->backgroundBlock($content, $this->data, array('content-wrapper', 'no-shrink', 'fullheight')); return $this->htmlElement($content, 'section', $attributes); diff --git a/framework/application/views/scripts/common/content.phtml b/framework/application/views/scripts/common/content.phtml index b0ce4f9..e6d1ea4 100644 --- a/framework/application/views/scripts/common/content.phtml +++ b/framework/application/views/scripts/common/content.phtml @@ -4,7 +4,9 @@ $content = $this->layout()->content . "\n"; echo $this->render('common/header.phtml'); echo '
'; echo '
'; +echo '
'; // Needed because FullPage.js doesn't work when the wrapper is a
element echo $content; -echo '
'; echo $this->render('common/footer.phtml'); echo '
'; +echo '
'; +echo '
'; diff --git a/framework/application/views/scripts/common/footer.phtml b/framework/application/views/scripts/common/footer.phtml index d7ff418..1006b6c 100644 --- a/framework/application/views/scripts/common/footer.phtml +++ b/framework/application/views/scripts/common/footer.phtml @@ -64,4 +64,6 @@ $res .= $this->markupDotclear($this->option('footer')); $res .= ''; // .footer-inner $res .= ''; // footer.legal -echo $res; \ No newline at end of file +echo '
'; +echo $res; +echo '
'; \ No newline at end of file diff --git a/framework/application/views/scripts/templates/home.phtml b/framework/application/views/scripts/templates/home.phtml index c2ef6ba..9c510a8 100644 --- a/framework/application/views/scripts/templates/home.phtml +++ b/framework/application/views/scripts/templates/home.phtml @@ -1,8 +1,6 @@ headScript()->addFullPage(); +//$this->headScript()->addFullPage(); $this->headScript()->addScriptAndStyle('210-home'); -echo '
'; // Needed because FullPage.js doesn't work when the wrapper is a
element -echo $this->home(); -echo '
'; \ No newline at end of file +echo $this->home(); \ No newline at end of file diff --git a/js/101-header.js b/js/101-header.js index b9d63bc..cf3f587 100644 --- a/js/101-header.js +++ b/js/101-header.js @@ -122,7 +122,7 @@ function changeHeaderStyle() { var scrollTop = $(window).scrollTop(); var wh = $(window).height(); var section; - $('#home > section').each(function () { + $('#contentWrapper > section').each(function () { var offset = $(this).offset().top; if (scrollTop >= offset && scrollTop <= offset + wh - 50) { section = $(this); diff --git a/js/210-home.js b/js/210-home.js index 346f3ea..28773c2 100644 --- a/js/210-home.js +++ b/js/210-home.js @@ -3,26 +3,50 @@ function load_home() { $(window).on('fluidbookresize', resizeHome); resizeHome(); - // FullPage.js setup - $('#home').fullpage({ - navigation: true, - navigationPosition: 'left', - verticalCentered: false - }); + // // FullPage.js setup + // $('#contentWrapper').fullpage({ + // navigation: true, + // navigationPosition: 'left', + // verticalCentered: false, + // afterRender: function() { + // console.log('FullPage rendered.'); + // }, + // afterLoad: function(anchorLink, index) { + // console.log('Loaded section #' + index); + // updateHeaderStyle(); + // }, + // onSlideLeave: function(anchorLink, index, slideIndex, direction, nextSlideIndex) { + // updateHeaderStyle(); + // } + // + // }); } -function resizeHome() { +// function updateHeaderStyle() { +// var headerClass = $('.fp-section.active').data('headerstyle'); +// console.info(headerClass); +// if (headerClass == 'light') { +// if (!$("header").hasClass('light')) { +// console.log('adding light...'); +// $("header").addClass('light').removeClass('dark'); +// } +// } else { +// if (!$("header").hasClass('dark')) { +// $("header").addClass('dark').removeClass('light'); +// } +// } +// } - // Todo: see if this can be removed completely if FullPage.js handles the section sizing... +function resizeHome() { // Resize sections - // var wh = $(window).outerHeight() / zoom; - // var ww = $(window).outerWidth() / zoom; - // $('#home > section').css('height', wh); - // - // - // resizeHomeContact(ww, wh); + var wh = $(window).outerHeight() / zoom; + var ww = $(window).outerWidth() / zoom; + $('#contentWrapper > section').css('height', wh); + + + resizeHomeContact(ww, wh); } function resizeHomeContact(ww, wh) { -- 2.39.5