init dropdown

This commit is contained in:
John BOTELLA 2019-03-11 18:03:39 +01:00
parent 5d7118340b
commit d8223bfe98
3 changed files with 198 additions and 10 deletions

View File

@ -1602,7 +1602,13 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
// Login name with photo and tooltip
$mode=-1;
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
$toprightmenu.=$user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
if(empty($conf->global->MAIN_TOP_MENU_DROPDOWN)){
$toprightmenu.=$user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
}
else{
$toprightmenu.= top_menu_user($user, $langs);
}
$toprightmenu.='</div></div>';
$toprightmenu.='</div>'."\n";
@ -1714,6 +1720,68 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
}
function top_menu_user(user $user, $langs){
$userImage = $userDropDownImage = '';
if (! empty($user->photo))
{
$userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1);
$userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1);
}
$btnUser = '
<div class="userimg atoplogin dropdown user user-menu open">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
'.$userImage.'
<span class="hidden-xs">'.($user->firstname ? $user->firstname : $user->login).'</span>
</a>
<div class="dropdown-menu">
<!-- User image -->
<div class="user-header">
'.$userDropDownImage.'
<p>
'.$user->getFullName($langs).'
<small>'.dol_print_date($user->date_creation).'</small>
</p>
</div>
<!-- Menu Body -->
<div class="user-body">
<div class="row">
<div class="col-xs-4 text-center">
<a href="#">btn01</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">btn02</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">btn03</a>
</div>
</div>
<!-- /.row -->
</div>
<!-- Menu Footer-->
<div class="user-footer">
<div class="pull-left">
<a href="#" class="btn btn-default btn-flat">Profile</a>
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat">Sign out</a>
</div>
</div>
</div>
</div>
';
return $btnUser;
}
/**
* Show left menu bar
*

View File

@ -0,0 +1,101 @@
<?php
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
/* <style type="text/css" > */
/*
Dropdown
*/
.open>.dropdown-menu {
display: block;
}
.dropdown-menu {
box-shadow: none;
border-color: #eee;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
/*
* MENU Dropdown
*/
.tmenu .dropdown-menu, .login_block .dropdown-menu {
position: absolute;
right: 0;
left: auto;
}
.tmenu .dropdown-menu, .login_block .dropdown-menu .user-body {
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.side-nav-vert .user-menu .dropdown-menu {
border-top-right-radius: 0;
border-top-left-radius: 0;
padding: 1px 0 0 0;
border-top-width: 0;
width: 280px;
}
.side-nav-vert .user-menu .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.side-nav-vert .user-menu .dropdown-menu > .user-header {
height: 175px;
padding: 10px;
text-align: center;
}
.dropdown-menu > li.user-header > img {
z-index: 5;
height: 90px;
width: 90px;
border: 3px solid;
border-color: transparent;
border-color: rgba(255, 255, 255, 0.2);
}
.dropdown-user-image {
border-radius: 50%;
vertical-align: middle;
z-index: 5;
height: 90px;
width: 90px;
border: 3px solid;
border-color: transparent;
border-color: rgba(255, 255, 255, 0.2);
max-width: 100%;
max-height :100%;
}
.dropdown-menu > .user-header{
background: rgb(<?php echo $colorbackhmenu1 ?>);
}

View File

@ -262,7 +262,7 @@ hr { border: 0; border-top: 1px solid #ccc; }
margin-top: 0;
margin-left: 5px;
margin-right: 5px;
font-family: <?php print $fontlist ?>;
font-family: <?php print $fontlist ?>;
display: inline-block;
padding: 4px 14px;
text-align: center;
@ -1301,6 +1301,16 @@ div#tmenu_tooltip {
<?php } else { ?>
padding-<?php echo $right; ?>: <?php echo ($maxwidthloginblock - 10); ?>px;
<?php } ?>
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
div.topmenuimage {
@ -1792,7 +1802,8 @@ div.login_block {
<?php print $right; ?>: 0;
top: <?php print $disableimages?'4px':'0'; ?>;
font-weight: bold;
<?php echo (empty($disableimages) && $maxwidthloginblock)?'max-width: '.$maxwidthloginblock.'px;':''; ?>
line-height: 10px;
<?php // echo (empty($disableimages) && $maxwidthloginblock)?'max-width: '.$maxwidthloginblock.'px;':''; ?>
<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?>
display: none;
<?php } ?>
@ -1817,24 +1828,27 @@ div.login a:hover {
}
div.login_block_user {
display: inline-block;
padding-top: 3px;
<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
/*<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
min-width: 120px;
<?php } ?>
<?php } ?>*/
}
div.login_block_other {
display: inline-block;
clear: <?php echo $disableimages?'none':'both'; ?>;
}
div.login_block_other { padding-top: 3px; text-align: right; }
div.login_block_other { padding-top: 0; text-align: right; }
.login_block_elem {
float: right;
vertical-align: top;
padding: 0px 3px 0px 4px !important;
height: 16px;
line-height: 50px;
height: 50px;
}
.atoplogin, .atoplogin:hover {
color: #<?php echo $colortextbackhmenu; ?> !important;
font-weight: normal !important;
}
.login_block_getinfo {
text-align: center;
@ -1844,6 +1858,7 @@ div.login_block_other { padding-top: 3px; text-align: right; }
}
.login_block_getinfo .atoplogin, .login_block_getinfo .atoplogin:hover {
color: #333 !important;
font-weight: normal !important;
}
.alogin, .alogin:hover {
font-weight: normal !important;
@ -1864,9 +1879,10 @@ img.login, img.printer, img.entity {
font-weight: bold;
}
.userimg.atoplogin img.userphoto, .userimgatoplogin img.userphoto { /* size for user photo in login bar */
width: 16px;
height: 16px;
border-radius: 8px;
width: 32px;
height: 32px;
border-radius: 50%;
background-size: contain;
background-size: contain;
}
img.userphoto { /* size for user photo in lists */
@ -5690,3 +5706,6 @@ div.tabsElem a.tab {
font-size: 12px;
}
}
<?php include dol_buildpath($path.'/theme/'.$theme.'/_dropdown.css.php', 0); ?>