Преглед изворни кода

#273 Cover image area: homepage cover

Alex Trofimov пре 10 година
родитељ
комит
7e8ca9fbaf

+ 1 - 1
inc/classes/BxDolCover.php

@@ -75,7 +75,7 @@ class BxDolCover extends BxDol implements iBxDolSingleton
 
     /**
      * Set custom cover options
-     * @param $aOptions - cover options, default template supports the following: image_url, menu, text
+     * @param $aOptions - cover options, default template supports the following: title. For more info @see template/cover.html
      * @param $sTemplateName - optional template name
      */
     public function set ($aOptions, $sTemplateName = false)

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -2144,6 +2144,7 @@ If it is not enabled then please consider implement this optimization, since it
     <string name="_sys_txt_form_entry_input_picture_use_as_thumb"><![CDATA[Use as Thumbnail]]></string>
 	<string name="_sys_txt_form_submission_error"><![CDATA[Incorrect info. Please, check your inputs and try to submit again.]]></string>
 
+    <string name="_sys_txt_homepage_cover"><![CDATA[Welcome!]]></string>
 	<string name="_sys_txt_login_description"><![CDATA[Not a member yet? <a href="{0}">Join now!</a>]]></string>
 	<string name="_sys_txt_login_error"><![CDATA[Entered email or password is incorrect. Please try again.]]></string>
 	<string name="_sys_txt_login_invalid_role"><![CDATA[Access denied]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -2145,6 +2145,7 @@
     <string name="_sys_txt_form_entry_input_picture_use_as_thumb"><![CDATA[Использовать в качестве Миниатюры]]></string>
 	<string name="_sys_txt_form_submission_error"><![CDATA[Неправильная информация. Пожалуйста, проверьте ввод и отошлите снова.]]></string>
 
+    <string name="_sys_txt_homepage_cover"><![CDATA[Добро пожаловать!]]></string>
 	<string name="_sys_txt_login_description"><![CDATA[Ещё нет аккаунта? <a href="{0}">Зарегистрируйтесь!</a>]]></string>
 	<string name="_sys_txt_login_error"><![CDATA[Введённый имейл или пароль неправильны. Пожалуйста, попытайтесь снова.]]></string>
 	<string name="_sys_txt_login_invalid_role"><![CDATA[Доступ запрещён]]></string>

+ 1 - 1
template/cover.html

@@ -1,5 +1,5 @@
 <div class="bx-menu-toolbar-padding">
-<div class="bx-cover-wrapper" <bx_if:bg>style="background-image:url(__image_url__)"</bx_if:bg>>
+<div class="bx-cover-wrapper __class__" <bx_if:bg>style="background-image:url(__image_url__)"</bx_if:bg>>
 
     <div class="bx-cover bx-def-centered bx-def-page-width bx-def-padding bx-def-box-sizing">
 

+ 5 - 1
template/css/cover.css

@@ -1,3 +1,4 @@
+
 .bx-cover-wrapper {
     background-image: url(../images/cover.jpg);
     background-color: #eee;
@@ -11,7 +12,6 @@
 
 .bx-cover {
     min-height:6rem;
-    height:100%;
     text-align:center;
 }
 
@@ -19,3 +19,7 @@
     font-weight:bold;
     text-shadow:0px 0px 0.125rem #000;
 }
+
+.bx-cover-homepage {
+    background-image: url(../images/cover-homepage.png);
+}

BIN
template/images/cover-homepage.png


+ 2 - 2
template/scripts/BxBaseCover.php

@@ -32,9 +32,9 @@ class BxBaseCover extends BxDolCover
      */
     public function display ()
     {
-        if (!$this->_aOptions || !$this->_sTemplateName) {
+        $this->_addJsCss();
 
-            $this->_addJsCss();
+        if (!$this->_aOptions || !$this->_sTemplateName) {
 
             $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
             $mixedParams = $oMenuSubmenu->getParamsForCover();

+ 5 - 2
template/scripts/BxBaseMenuSubmenu.php

@@ -91,16 +91,19 @@ class BxBaseMenuSubmenu extends BxTemplMenu
     public function getParamsForCover ()
     {
         $aMenuItemSelected = $this->getSelectedMenuItem ();
-        if (!$aMenuItemSelected || (isset($aMenuItemSelected['set_name']) && 'sys_site' == $aMenuItemSelected['set_name'] && 'home' == $aMenuItemSelected['name']))
+        if (!$aMenuItemSelected)
             return '';
 
+        // (isset($aMenuItemSelected['set_name']) && 'sys_site' == $aMenuItemSelected['set_name'] && 'home' == $aMenuItemSelected['name']) - homepage detection
+
         $oMenuActions = BxDolMenu::getObjectInstance($this->_sObjectActionsMenu);
 
         $aVars = array (
+            'class' => '',
             'object' => $this->_sObject,
             'id' => 'bx-menu-submenu-menu',
             'title' => $aMenuItemSelected['title'],
-            'link' => BxDolPermalinks::getInstance()->permalink($aMenuItemSelected['link']),
+            'link' => BxDolPermalinks::getInstance()->permalink($aMenuItemSelected['link']),            
             'actions' => $oMenuActions ? $oMenuActions->getCode() : '',
             'bx_if:image' => array (
                 'condition' => false !== strpos($aMenuItemSelected['icon'], '.'),

+ 19 - 0
template/scripts/BxBasePageHome.php

@@ -18,6 +18,25 @@ class BxBasePageHome extends BxTemplPage
     {
         parent::__construct($aObject, $oTemplate);
         $this->addMarkers(array('site_title' => getParam('site_title')));
+
+        $oCover = BxDolCover::getInstance();
+        $oCover->set(array(
+            'class' => 'bx-cover-homepage',
+            'title' => _t('_sys_txt_homepage_cover'),
+            'actions' => '',
+            'bx_if:image' => array (
+                'condition' => false,
+                'content' => array(),
+            ),
+            'bx_if:icon' => array (
+                'condition' => false,
+                'content' => array(),
+            ),
+            'bx_if:bg' => array (
+                'condition' => false,
+                'content' => array(),
+            ),
+        ));
     }
 
     public function getCode ()