Explorar o código

#110 - option to show title on hover

Alex Trofimov %!s(int64=12) %!d(string=hai) anos
pai
achega
04c71534df

+ 1 - 1
inc/classes/BxDolGridQuery.php

@@ -79,7 +79,7 @@ class BxDolGridQuery extends BxDolDb
             if (!$aActions || !is_array($aActions))
                 continue;
             foreach ($aActions as $sKey => $aRow)
-                $aObject[$sActionField][$sKey] = $aRow['title'] || $aRow['icon'] ? array('title' => _t($aRow['title']), 'icon' => $aRow['icon'], 'confirm' => $aRow['confirm']) : array();
+                $aObject[$sActionField][$sKey] = $aRow['title'] || $aRow['icon'] ? array('title' => _t($aRow['title']), 'icon' => $aRow['icon'], 'confirm' => $aRow['confirm'], 'icon_only' => $aRow['icon_only']) : array();
         }
 
         return $aObject;

+ 1 - 0
install/sql/system.sql

@@ -2864,6 +2864,7 @@ CREATE TABLE IF NOT EXISTS `sys_grid_actions` (
   `name` varchar(255) NOT NULL,
   `title` varchar(255) NOT NULL,
   `icon` varchar(255) NOT NULL,
+  `icon_only` tinyint(4) NOT NULL DEFAULT '0',
   `confirm` tinyint(4) NOT NULL DEFAULT '1',
   `order` int(11) NOT NULL,
   UNIQUE KEY `object_name_type` (`object`,`type`,`name`)

+ 2 - 5
template/grid.html

@@ -2,7 +2,7 @@
 <div id="__id_wrap__">
 
     <bx_if:display_header>
-        <div class="bx-grid-header bx-def-margin-top">
+        <div class="bx-grid-header bx-def-margin-top bx-clearfix">
 
             <bx_if:filter>
                 <div style="float:left;">
@@ -16,7 +16,6 @@
                 </div>
             </bx_if:actions_independent>
 
-            <div class="bx-clear"></div>
         </div>
     </bx_if:display_header>
 
@@ -46,7 +45,7 @@
 
         <hr class="bx-def-hr" />
 
-        <div class="bx-grid-footer bx-def-margin-bottom bx-def-margin-sec-top">
+        <div class="bx-grid-footer bx-def-margin-bottom bx-def-margin-sec-top bx-clearfix">
             <bx_if:actions_bulk>
                 <div style="float:left;">
                     __actions_bulk__
@@ -56,8 +55,6 @@
             <div style="float:right;">
                 __paginate__
             </div>
-
-            <div class="bx-clear"></div>
         </div>
 
     </div>

+ 4 - 1
template/scripts/BxBaseGrid.php

@@ -519,6 +519,9 @@ class BxBaseGrid extends BxDolGrid
 
     protected function _getActionDefault ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
+        if ($a['icon_only'] && empty($a['attr']['title']) && !empty($a['title']))
+            $a['attr']['title'] = $a['title'];
+
         $sAttr = $this->_convertAttrs(
             $a, 'attr',
             'bx-btn bx-def-margin-sec-left' . ($isSmall ? ' bx-btn-small' : '') . ($isDisabled ? ' bx-btn-disabled' : '') // add default classes
@@ -532,7 +535,7 @@ class BxBaseGrid extends BxDolGrid
             elseif ($sIconUrl = $this->_oTemplate->getIconUrl($a['icon']))
                 $sImage = '<i style="background-image:url(' . $sIconUrl . ');"></i>';
         }
-        return '<button ' . $sAttr . '>' . $sIcon . $sImage . $a['title'] . '</button>';
+        return '<button ' . $sAttr . '>' . $sIcon . $sImage . ($a['icon_only'] ? '' : $a['title']) . '</button>';
     }
 
     protected function _getActionDivider ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())