Fix badge markup in the BadgeNavigationItemRenderer

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-27 14:16:51 +02:00
parent 30ed3ad760
commit d59b09ca48
1 changed files with 8 additions and 7 deletions

View File

@ -19,7 +19,7 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
/** /**
* The tooltip text for the badge * The tooltip text for the badge
* *
* @var string * @var string
*/ */
protected $title; protected $title;
@ -28,7 +28,7 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
* *
* The state identifier defines the background color of the badge. * The state identifier defines the background color of the badge.
* *
* @var string * @var string
*/ */
protected $state; protected $state;
@ -94,7 +94,7 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
*/ */
public function render(NavigationItem $item = null) public function render(NavigationItem $item = null)
{ {
return $this->renderBadge() . parent::render($item); return '<div class="clearfix">' . $this->renderBadge() . parent::render($item) . '</div>';
} }
/** /**
@ -104,11 +104,12 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
*/ */
protected function renderBadge() protected function renderBadge()
{ {
if (($count = $this->getCount()) > 0) { if ($count = $this->getCount()) {
$view = $this->view();
return sprintf( return sprintf(
'<div title="%s" class="badge-container"><span class="badge badge-%s">%s</span></div>', '<span title="%s" class="badge pull-right state-%s">%s</span>',
$this->view()->escape($this->getTitle()), $view->escape($this->getTitle()),
$this->view()->escape($this->getState()), $view->escape($this->getState()),
$count $count
); );
} }