Răsfoiți Sursa

#101 menu switcher in account popup

Alex Trofimov 12 ani în urmă
părinte
comite
734fc6da38

+ 5 - 1
inc/classes/BxDolProfileQuery.php

@@ -49,7 +49,11 @@ class BxDolProfileQuery extends BxDolDb implements iBxDolSingleton
      */
      */
     public function getProfilesByAccount ($iAccountId)
     public function getProfilesByAccount ($iAccountId)
     {
     {
-        $sSql = $this->prepare("SELECT * FROM `sys_profiles` WHERE `account_id` = ?", $iAccountId);
+        bx_import('BxDolAccountQuery');
+        $oAccountQuery = BxDolAccountQuery::getInstance();
+        $aAccountInfo = $oAccountQuery->getInfoById($iAccountId);
+
+        $sSql = $this->prepare("SELECT * FROM `sys_profiles` WHERE `account_id` = ? ORDER BY `id` = ? DESC", $iAccountId, $aAccountInfo['profile_id']);
         return $this->getAllWithKey($sSql, 'id');
         return $this->getAllWithKey($sSql, 'id');
     }
     }
 
 

+ 5 - 1
inc/js/functions.js

@@ -377,8 +377,12 @@ function bx_menu_slide (jSel, e, sPosition) {
         });
         });
 
 
         setTimeout(function () {
         setTimeout(function () {
-           
+
+            var iWidthPrev = $(window).width();
             $(window).on('resize.bx-sliding-menu', function () {
             $(window).on('resize.bx-sliding-menu', function () {
+                if ($(this).width() == iWidthPrev)
+                    return;
+                iWidthPrev = $(this).width();
                 fCloseAllOpened();
                 fCloseAllOpened();
             });
             });
  
  

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

@@ -2023,6 +2023,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_login_description"><![CDATA[Not a member yet? <a href="{0}">Join now!</a>]]></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_error"><![CDATA[Entered email or password is incorrect. Please try again.]]></string>
 	<string name="_sys_txt_login_invalid_role"><![CDATA[Access denied]]></string>
 	<string name="_sys_txt_login_invalid_role"><![CDATA[Access denied]]></string>
+    <string name="_sys_txt_my_profiles"><![CDATA[<b class="bx-def-font-h1">@</b> my profiles...</a>]]></string>
     <string name="_sys_txt_new_picture"><![CDATA[New Picture]]></string>
     <string name="_sys_txt_new_picture"><![CDATA[New Picture]]></string>
     <string name="_sys_txt_no_picture_uploaded"><![CDATA[No picture uploaded]]></string>
     <string name="_sys_txt_no_picture_uploaded"><![CDATA[No picture uploaded]]></string>
     <string name="_sys_txt_n_friends"><![CDATA[{0} friends]]></string>
     <string name="_sys_txt_n_friends"><![CDATA[{0} friends]]></string>

+ 6 - 0
modules/boonex/ocean/data/template/system/css/menu.css

@@ -32,6 +32,12 @@ ul.bx-menu-toolbar li a .sys-icon-a {
     margin-top:1rem;
     margin-top:1rem;
 }
 }
 
 
+/* --------------- floating blocks menu */
+
+.bx-sliding-menu-fullheight {
+    height:calc(100% - 4rem);
+}
+
 /* --------------- account popup menu */
 /* --------------- account popup menu */
 .bx-menu-account-popup-profile {
 .bx-menu-account-popup-profile {
 	font-weight: bold;
 	font-weight: bold;

+ 9 - 5
template/css/account.css

@@ -1,17 +1,21 @@
 
 
+.sys-profile-switch-row {
+    margin-top:1px;
+}
+
 .sys-profile-switch-row-control,
 .sys-profile-switch-row-control,
 .sys-profile-switch-row-unit {
 .sys-profile-switch-row-unit {
     display:inline-block;
     display:inline-block;
     vertical-align:middle;
     vertical-align:middle;
 }
 }
 
 
-.sys-profile-switch-row-unit .bx-persons-unit {
-    margin-bottom:0;
+.sys-profile-switch-row-unit .bx-def-unit {
+    margin:0;
 }
 }
 
 
 .sys-profile-switch-row-control .sys-icon {
 .sys-profile-switch-row-control .sys-icon {
     display:inline-block;
     display:inline-block;
-    width:32px;
-    height:32px;
-    font-size:32px;
+    width:2rem;
+    height:2rem;
+    font-size:2rem;
 }
 }

+ 4 - 0
template/css/default.less

@@ -19,6 +19,10 @@
 .bx-def-margin-neg { 
 .bx-def-margin-neg { 
     .margin(-@bx-margin);
     .margin(-@bx-margin);
 }
 }
+.bx-def-margin-neg-leftright { 
+    .margin-left(-@bx-margin);
+    .margin-right(-@bx-margin);
+}
 .bx-def-margin-rightbottomleft {
 .bx-def-margin-rightbottomleft {
     .margin-right(@bx-margin);
     .margin-right(@bx-margin);
     .margin-bottom(@bx-margin);
     .margin-bottom(@bx-margin);

+ 17 - 6
template/css/menu.css

@@ -276,17 +276,33 @@ ul.bx-menu-toolbar li .sys-icon {
 }
 }
 
 
 .bx-sliding-menu-main {
 .bx-sliding-menu-main {
-    width:100%;
+    width:100%;    
     opacity:0.9;
     opacity:0.9;
     overflow-x:auto;
     overflow-x:auto;
     /* -webkit-overflow-scrolling:touch; */
     /* -webkit-overflow-scrolling:touch; */
 }
 }
+
+.bx-sliding-menu-fullheight {
+    height:calc(100% - 3rem);
+    overflow-x:hidden;
+    overflow-y:auto;
+}
+
 .bx-sliding-menu-main ul.bx-menu-floating-blocks-big {
 .bx-sliding-menu-main ul.bx-menu-floating-blocks-big {
     display:table;
     display:table;
     margin:0 auto;
     margin:0 auto;
     white-space:nowrap;
     white-space:nowrap;
 }
 }
 
 
+.bx-sliding-menu-main .bx-menu-account-popup-profile-switcher {
+    overflow:hidden;
+
+}
+
+.bx-menu-account-popup-profile-switcher-link b {
+    vertical-align:middle;
+}
+
 .bx-popup-content .bx-menu-floating-blocks {
 .bx-popup-content .bx-menu-floating-blocks {
     width:256px;
     width:256px;
     width:16rem;
     width:16rem;
@@ -439,8 +455,3 @@ ul.bx-menu-btns-hor li {
 .bx-popup-content .bx-menu-account-popup {
 .bx-popup-content .bx-menu-account-popup {
     min-width:17em;
     min-width:17em;
 }
 }
-
-.bx-menu-account-popup-switch-profile:hover,
-.bx-menu-account-popup-switch-profile {
-    text-decoration:none;
-}

+ 4 - 3
template/menu_account_popup.html

@@ -1,16 +1,17 @@
 
 
-<div id="bx-sliding-menu-account" class="bx-sliding-menu-main bx-def-z-index-nav bx-def-color-bg-block bx-def-border-bottom bx-search-site" style="display:none; overflow:hidden; height:100%; opacity:1;">
+<div id="bx-sliding-menu-account" class="bx-sliding-menu-main bx-sliding-menu-fullheight bx-def-z-index-nav bx-def-color-bg-block bx-def-border-bottom bx-def-box-sizing bx-search-site" style="display:none; opacity:1;">
 
 
     <a class="bx-sliding-menu-close bx-def-margin bx-def-font-h1" href="javascript:void(0);" onclick="bx_menu_slide('#bx-sliding-menu-account')"><i class="sys-icon times"></i></a>
     <a class="bx-sliding-menu-close bx-def-margin bx-def-font-h1" href="javascript:void(0);" onclick="bx_menu_slide('#bx-sliding-menu-account')"><i class="sys-icon times"></i></a>
 
 
     <div class="bx-menu-account-popup bx-menu-object-__object__ bx-def-padding">
     <div class="bx-menu-account-popup bx-menu-object-__object__ bx-def-padding">
         <div class="bx-def-font-h2">
         <div class="bx-def-font-h2">
             <span class="bx-menu-account-popup-profile">__profile_display_name__</span>
             <span class="bx-menu-account-popup-profile">__profile_display_name__</span>
-            <a title="<bx_text_attribute:_sys_switch_profile />" class="bx-menu-account-popup-switch-profile bx-def-margin-sec-left" href="__url_switch_profile__"><i class="sys-icon exchange"></i></a>
         </div>
         </div>
         <div class="bx-def-margin-top bx-def-margin-bottom">__menu_account__</div>
         <div class="bx-def-margin-top bx-def-margin-bottom">__menu_account__</div>
         <div class="bx-def-color-bg-sec" style="height:0.5em; margin-left:-3em; margin-right:-3em;">1</div>
         <div class="bx-def-color-bg-sec" style="height:0.5em; margin-left:-3em; margin-right:-3em;">1</div>
-        <div>__menu_notifications__</div>
+        <div>__menu_notifications__</div>        
     </div>
     </div>
+    <div class="bx-menu-account-popup-profile-switcher bx-def-box-sizing bx-def-padding-leftright">__profile_switcher__</div>
+    <div class="bx-menu-account-popup-profile-switcher-link bx-def-padding"><a href="__url_switch_profile__"><bx_text:_sys_txt_my_profiles /></div>
 </div>
 </div>
 
 

+ 1 - 3
template/profile_switch_row.html

@@ -1,8 +1,6 @@
 <bx_repeat:row>
 <bx_repeat:row>
 
 
-<hr class="bx-def-hr-auto" />
-
-<div class="sys-profile-switch-row">
+<div class="sys-profile-switch-row bx-def-margin-neg-leftright bx-def-padding-leftright bx-def-padding-sec-topbottom __class__">
     <div class="sys-profile-switch-row-control bx-def-margin-right">
     <div class="sys-profile-switch-row-control bx-def-margin-right">
         <bx_if:active>
         <bx_if:active>
             <i class="sys-icon check-square-o"></i>
             <i class="sys-icon check-square-o"></i>

+ 5 - 0
template/scripts/BxBaseMenuAccountPopup.php

@@ -24,11 +24,16 @@ class BxBaseMenuAccountPopup extends BxTemplMenu
     protected function _getTemplateVars ()
     protected function _getTemplateVars ()
     {
     {
         $aVars = parent::_getTemplateVars ();
         $aVars = parent::_getTemplateVars ();
+
         $aVars['bx_repeat:menu_items'] = array(true);
         $aVars['bx_repeat:menu_items'] = array(true);
         $aVars['profile_display_name'] = BxDolProfile::getInstance()->getDisplayName();
         $aVars['profile_display_name'] = BxDolProfile::getInstance()->getDisplayName();
         $aVars['url_switch_profile'] = BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher');
         $aVars['url_switch_profile'] = BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher');
         $aVars['menu_account'] = BxDolMenu::getObjectInstance('sys_account')->getCode();
         $aVars['menu_account'] = BxDolMenu::getObjectInstance('sys_account')->getCode();
         $aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
         $aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
+
+        $a = BxDolService::call('system', 'account_profile_switcher', array(), 'TemplServiceProfiles');
+        $aVars['profile_switcher'] = $a['content'];
+
         return $aVars;
         return $aVars;
     }
     }
 }
 }

+ 1 - 0
template/scripts/BxBaseServiceProfiles.php

@@ -154,6 +154,7 @@ class BxBaseServiceProfiles extends BxDol
             if ($aProfile['type'] == 'system') // skip system account profile
             if ($aProfile['type'] == 'system') // skip system account profile
                 continue;
                 continue;
             $aVars['bx_repeat:row'][] = array (
             $aVars['bx_repeat:row'][] = array (
+                'class' => $iLoggedPofileId == $aProfile['id'] ? '' : 'bx-def-color-bg-box',
                 'bx_if:active' => array (
                 'bx_if:active' => array (
                     'condition' => $iLoggedPofileId == $aProfile['id'],
                     'condition' => $iLoggedPofileId == $aProfile['id'],
                     'content' => array('id' => $aProfile['id']),
                     'content' => array('id' => $aProfile['id']),

+ 1 - 1
template/search.html

@@ -1,5 +1,5 @@
 
 
-<div id="bx-sliding-menu-search" class="bx-sliding-menu-main bx-def-z-index-nav bx-def-color-bg-block bx-search-site" style="display:none; height:100%; opacity:1;">
+<div id="bx-sliding-menu-search" class="bx-sliding-menu-main bx-sliding-menu-fullheight bx-def-z-index-nav bx-def-color-bg-block bx-search-site" style="display:none; opacity:1;">
     <a class="bx-sliding-menu-close bx-def-margin bx-def-font-h1" href="javascript:void(0);" onclick="bx_menu_slide('#bx-sliding-menu-search')"><i class="sys-icon times"></i></a>
     <a class="bx-sliding-menu-close bx-def-margin bx-def-font-h1" href="javascript:void(0);" onclick="bx_menu_slide('#bx-sliding-menu-search')"><i class="sys-icon times"></i></a>
     <div class="bx-def-padding">
     <div class="bx-def-padding">
         <div class="bx-def-font-h1 bx-def-margin-bottom">&nbsp;</div>
         <div class="bx-def-font-h1 bx-def-margin-bottom">&nbsp;</div>