From f4545a206834648b321edb1b87889af989e4d05c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2019 17:31:54 +0200 Subject: [PATCH] Debug method MAIN_STATUS_USES_CSS --- htdocs/core/lib/functions.lib.php | 46 +++++++------ htdocs/theme/eldy/badges.inc.php | 19 ++++-- htdocs/theme/md/badges.inc.php | 110 +++++++++++++++++++----------- htdocs/theme/md/style.css.php | 3 +- 4 files changed, 114 insertions(+), 64 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09b184ad349..ca6a4a93e4e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8094,7 +8094,7 @@ function roundUpToNextMultiple($n, $x = 5) function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) { $attr=array( - 'class'=>'badge'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'') + 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'') ); if(empty($html)){ @@ -8155,26 +8155,12 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st global $conf; $return = ''; - $dolGetBadgeParams = array(); - if(!empty($params['badgeParams'])){ + + if (!empty($params['badgeParams'])){ $dolGetBadgeParams = $params['badgeParams']; } - // image's filename are still in French - $statusImg=array( - 'status0' => 'statut0' - ,'status1' => 'statut1' - ,'status2' => 'statut2' - ,'status3' => 'statut3' - ,'status4' => 'statut4' - ,'status5' => 'statut5' - ,'status6' => 'statut6' - ,'status7' => 'statut7' - ,'status8' => 'statut8' - ,'status9' => 'statut9' - ); - // TODO : add a hook if ($displayMode == 0) { @@ -8184,12 +8170,34 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel); } // use status with images - elseif (empty($conf->global->MAIN_STATUS_USES_CSS)){ + elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) { $return = ''; $htmlLabel = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'':''); $htmlLabelShort = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'':''); - if(!empty($statusImg[$statusType])){ + // For small screen, we use the short label instead of long label. + if (! empty($conf->dol_optimize_smallscreen)) + { + if ($displayMode == 0) $displayMode = 1; + elseif ($displayMode == 4) $displayMode = 2; + elseif ($displayMode == 6) $displayMode = 5; + } + + // image's filename are still in French, so we use this array to convert + $statusImg=array( + 'status0' => 'statut0' + ,'status1' => 'statut1' + ,'status2' => 'statut2' + ,'status3' => 'statut3' + ,'status4' => 'statut4' + ,'status5' => 'statut5' + ,'status6' => 'statut6' + ,'status7' => 'statut7' + ,'status8' => 'statut8' + ,'status9' => 'statut9' + ); + + if (!empty($statusImg[$statusType])){ $htmlImg = img_picto($statusLabel, $statusImg[$statusType]); }else{ $htmlImg = img_picto($statusLabel, $statusType); diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 0f635941a8e..d3d22c622dc 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -22,6 +22,11 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> box-sizing: border-box; } +.badge-status { + font-size: 1em; + padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */ +} + .badge-pill, .tabs .badge { padding-right: .5em; padding-left: .5em; @@ -31,7 +36,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> .badge-dot { padding: 0; border-radius: 50%; - padding: 0.25rem; + padding: 0.45em; vertical-align: middle; } @@ -168,9 +173,10 @@ a.badge-dark:focus, a.badge-dark:hover { background-color: ; } + /* -* STATUS BADGES -*/ + * STATUS BADGES + */ border-color: rgba(255,255,255,0); box-sizing: border-box; } -/* Themes for badges */ + +.badge-status { + font-size: 1em; + padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */ +} .badge-pill, .tabs .badge { padding-right: .5em; @@ -158,46 +162,74 @@ a.badge-dark:focus, a.badge-dark:hover { background-color: ; } + /* -* STATUS BADGES -*/ - -/* Default Status */ - + * STATUS BADGES + */ : 3px; } .pictowarning { - vertical-align: text-bottom; + /* vertical-align: text-bottom; */ + color: #9f4705; } .pictomodule { width: 14px;