Skip to content

Commit

Permalink
Improved action rendering, when only one action is available
Browse files Browse the repository at this point in the history
  • Loading branch information
vovayatsyuk committed Feb 8, 2017
1 parent 77a03af commit 8dfcc87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
22 changes: 14 additions & 8 deletions app/code/community/TM/Core/Block/Adminhtml/Renderer/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ public function render(Varien_Object $row)
}

$result = '<div class="tm-action-select-wrap">';
$result .= '<a href="javascript:void(0)" class="tm-action-select">'
. Mage::helper('adminhtml')->__('Select')
. '</a>';
if (count($actions) > 1) {
$result .= '<a href="javascript:void(0)" class="tm-action-select">'
. Mage::helper('adminhtml')->__('Select')
. '</a>';

$result .= '<ul class="tm-action-menu" style="display: none;">';
foreach ($actions as $action) {
$result .= '<li>' . $action . '</li>';
$result .= '<ul class="tm-action-menu">';
foreach ($actions as $action) {
$result .= '<li>' . $action . '</li>';
}
$result .= '</ul>';
} else {
foreach ($actions as $action) {
$result .= $action;
}
}
$result .= '</ul>';

$result .= '</div>';

return $result;
}
}
3 changes: 3 additions & 0 deletions js/tm/adminhtml/core/actions.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
.tm-action-select-wrap {
position: relative;
}
.tm-action-select-wrap a {
text-decoration: none;
}
.tm-action-select {
text-decoration: none;
padding-right: 15px;
Expand Down

0 comments on commit 8dfcc87

Please sign in to comment.