finishing up with the new layout for the home page glm blocks
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 26 Sep 2014 19:25:54 +0000 (15:25 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 14 Oct 2014 15:17:08 +0000 (11:17 -0400)
Showing three blocks across on the bottom of the home page.

Toolkit/Blocks/Admin/EditPage.php
Toolkit/Blocks/css/style.css
Toolkit/Blocks/templates/editPage.html
Toolkit/Page.php
setup.phtml
styles.css
templates/template.html

index 92fc483..b2ca0a7 100644 (file)
@@ -257,13 +257,15 @@ class Toolkit_Blocks_Admin_EditPage
             if (is_numeric($this->_pageId)) {
                 $page->pageName = $this->_getPageName();
             }
-            $page->baseUrl = MEDIA_BASE_URL;
-            $page->pageOn  = $this->_pageId;
+            $page->baseUrl    = MEDIA_BASE_URL;
+            $page->pageOn     = $this->_pageId;
+            $page->isHomePage = ($this->_pageId  == HOME_ID);
             $page->blocks
                 = ($this->_pageId)
                 ? $this->_getBlocks()
                 : false;
             $page->canCreateOnAnyPage = $this->_canCreateOnAnyPage;
+            //echo '<pre>'.print_r($page, true).'</pre>';exit;
             return $tpl->bufferedOutputObject($page);
         }
     }
index 402c512..97e82df 100644 (file)
@@ -73,7 +73,6 @@ h2 {
     margin-left: -25px;
 }
 #newBlockForm {
-    display: none;
     float: left;
     clear: both;
     list-style-type: none;
@@ -168,7 +167,6 @@ a#editBtn:hover {
     color: #09F;
     background-position: 0px -28px;
     }
-.deleteBlock {display:none;}
 a#deleteBtn {
     background: url(../assets/btn_delete.gif) no-repeat;
     }
index 2cda95c..1ae3563 100644 (file)
@@ -2,8 +2,14 @@
 <a id="backBtn" href="../admin/blocks.php">Back to All Blocks</a>
 {end:}
 <div id="blocksEditWrapper">
-    <h2 style="display: none;">Add New {pageName} Block</h2>
+    {if:isHomePage}
+    <h2>Add New {pageName} Block</h2>
+    {end:}
+    {if:isHomePage}
     <ul id="newBlockForm">
+    {else:}
+    <ul style="display:none;" id="newBlockForm">
+    {end:}
         <li class="ui-widget-content">
             <form
                 id="newForm"
@@ -24,6 +30,7 @@
                         <span class="button">Choose Image 1</span>
                     </span>
                 </div>
+                {if:!isHomePage}
                 <div class="imageBlock">
                     <span class="file-wrapper">
                         <input
@@ -34,6 +41,7 @@
                         <span class="button">Choose Image 2</span>
                     </span>
                 </div>
+                {end:}
                 <div class="textBlock">
                     <input
                         class="title"
                         class="textBlockTextArea"
                         style="min-height:{block[imageHeight]}px;">{block[description]}</textarea>
                     <input id="updateBtn" type="submit" value="Update" />
+                    {if:isHomePage}
                     <div class="deleteBlock">
                         <a
                             id="deleteBtn2"
                             href="{block[deleteUrl]:h}"
                             rel="{block[id]}">Delete</a>
                     </div>
+                    {end:}
                 </div>
                 <div class="fileInputs">
                     <div class="imageBlock">
                         <img id="sideImage" src="{block[imageUrl]:h}">
                         {end:}
                     </div>
+                    {if:!isHomePage}
                     <div class="imageBlock">
-                    <div class="upload">
-                        <input type="file" class="image" name="image2">
-                        <a id="upload_text2" class="button">
-                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change Image 2
-                        </a>
+                        <div class="upload">
+                            <input type="file" class="image" name="image2">
+                            <a id="upload_text2" class="button">
+                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change Image 2
+                            </a>
+                        </div>
+                        {if:block[image2Url]}
+                        <img id="sideImage2" src="{block[image2Url]:h}">
+                        {end:}
                     </div>
-                    {if:block[image2Url]}
-                    <img id="sideImage2" src="{block[image2Url]:h}">
                     {end:}
                 </div>
-                </div>
 
             </form>
         </li>
index b51e86c..1d1e6e9 100755 (executable)
@@ -966,14 +966,29 @@ class Toolkit_Page
         }
         $cache = new Cache_Lite($GLOBALS['cacheOptions']);
         if ($blockContent = $cache->get($parentId, 'Block')) {
-            $this->headlines = unserialize($blockContent);
+            $homePageBlocks  = unserialize($blockContent);
+            $this->headlines = $homePageBlocks['headlines'];
+            $this->blocks    = $homePageBlocks['blocks'];
         } else {
             $blocks = new Toolkit_Blocks_Display(
                 Toolkit_Database::getInstance()
             );
-            $this->headlines
-                = $blocks->getPageBlocksAsArray((int)$parentId);
-            $cache->save(serialize($this->headlines), $parentId, 'Block');
+            $blocks = $blocks->getPageBlocksAsArray((int)$parentId);
+            if (count($blocks) > 1) {
+                $blocks = array_reverse($blocks);
+                $this->headlines[0] = array_pop($blocks);
+                $blocks[0]['end'] = true;
+                $blocks = array_reverse($blocks);
+                $blocks = array_chunk($blocks, 3);
+                $this->blocks    = $blocks;
+            } else {
+                $this->headlines = $blocks;
+            }
+            $homePageBlocks = array(
+                'headlines' => $this->headlines,
+                'blocks'   => $this->blocks
+            );
+            $cache->save(serialize($homePageBlocks), $parentId, 'Block');
         }
         $this->hasHeadlines = !empty($this->headlines);
     }
index 68746cf..ac8d89f 100644 (file)
@@ -882,6 +882,7 @@ define('PHOTO_SMALL_URL', FILE_SERVER_URL.IS_OWNER_ID."/pgs2/");
  * Home page headlines thumbnail
  */
 define('HOMEPAGE_HEADLINE_THUMB', FILE_SERVER_URL.IS_OWNER_ID."/homepageHeadlineThumb/");
+define('HEADLINE_THUMB_BOTTOM', FILE_SERVER_URL.IS_OWNER_ID."/headlineThumbBottom/");
 define('MAIN_NAV_THUMB', FILE_SERVER_URL.IS_OWNER_ID."/mainNavThumb/");
 define('HEADLINE_THUMB', FILE_SERVER_URL.IS_OWNER_ID.'/headline/');
 define('HEADLINE_MAIN', HEADLINE_THUMB);
index be82505..66c3262 100644 (file)
@@ -1384,4 +1384,27 @@ footer .copyright .separator {
 .header-content .content p,
 .bottom-content .content p {
     font-size: 10pt;
-}
\ No newline at end of file
+}
+.homeBlockRow {
+    background-color: #fff;
+}
+.homeBlocks {
+    background-color: #fff;
+    /*border: solid 1px #000;*/
+    padding: 5px;
+    margin-bottom: 20px;
+}
+.homeBlocks p {
+    line-height: 130%;
+}
+.blockImg {
+    margin-bottom: 10px;
+}
+.homeBlockHeader {
+    margin-top: 10px;
+    margin-bottom: 10px;
+    min-height: 24px;
+}
+.inner-container p a {
+    text-decoration: underline;
+}
index 6fcbb90..952e902 100755 (executable)
@@ -18,7 +18,7 @@
     {styles:h}
     <link rel="stylesheet" href="{mediaBaseURL:h}css/foundation.min.css">
     <link rel="stylesheet" href="{mediaBaseURL:h}css/normalize.css">
-    <link rel="stylesheet" href="{mediaBaseURL:h}styles.css">
+    <link rel="stylesheet" href="{mediaBaseURL:h}styles.css?v=1">
     <link rel="stylesheet" href="{mediaBaseURL:h}css/{seasonStyleSheet}.css">
     <script src="{mediaBaseURL:h}js/vendor/modernizr.js"></script>
     {topScripts:h}
             </div>
 
             <!-- Bottom -->
+            {if:blocks}
+                {foreach:blocks,blockRow}
+                    <div class="row homeBlockRow" flexy:if="isHomePage">
+                        {foreach:blockRow,block}
+                        {if:block[end]}
+                        <div class="small-12 medium-4 columns homeBlocks end">
+                        {else:}
+                        <div class="small-12 medium-4 columns homeBlocks">
+                        {end:}
+                            <div class="row">
+                                <div class="small-11 small-centered columns show-for-small text-center homeBlockHeader">
+                                    {if:block[href]}<a href="{block[href]:h}">{end:}
+                                    <h3>{block[header]}</h3>
+                                    {if:block[href]}</a>{end:}
+                                </div>
+                                <div class="small-11 small-centered columns text-center blockImg">
+                                  {if:block[img]}
+                                      {if:block[href]}
+                                          <a class="th radius" href="{block[href]:h}">
+                                      {else:}
+                                          <a class="th radius" href="#" onclick="return false;">
+                                      {end:}
+                                        <img src="<?php echo HEADLINE_THUMB_BOTTOM;?>{block[img]:h}">
+                                        </a>
+                                  {end:}
+                                </div>
+                                <div class="small-11 small-centered show-for-medium-up columns text-center homeBlockHeader">
+                                    {if:block[href]}<a href="{block[href]:h}">{end:}
+                                    <h3>{block[header]}</h3>
+                                    {if:block[href]}</a>{end:}
+                                </div>
+                                <div class="small-10 small-centered columns blockDescr">
+                                {block[descr]:h}
+                                </div>
+                            </div>
+                        </div>
+                        {end:}
+                    </div>
+                {end:}
+            {end:}
             {if:headlines[1]}
             <div class="row  collapse bottom-content" flexy:if="isHomePage">
               <div class="small-12 medium-5 columns content">