Skip to content

Add an ability to use multiple badges in a left sidebar menu item wit… #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

masybit
Copy link

@masybit masybit commented Dec 23, 2016

…h sub items

Usage:

[ 'label' => 'Personnes ', 'url' => './#', 'icon' => 'users', 'badges' => [ ['content' => Personne::find()->count(), 'badgeOptions' => ['class' => 'bg-aqua']] ], 'items' => [ [ 'label' => 'Liste des personnes', 'url' => ['/personne'], 'icon' => 'list' ], [ 'label' => 'Ajouter une personne', 'url' => ['/personne/create'], 'icon' => 'plus' ], ], ]

20161222-2234

…h sub items

Adding an ability to use multiple badges in a left sidebar menu item
with sub items.

Usage:

[
'label' => 'Label to Display', 'url' => './#', 'icon' => 'icon-name',
'badges' => [
['content' => $some-numbers1, 'badgeOptions' => ['class' => 'some css
class']]
['content' => $some-numbers2, 'badgeOptions' => ['class' => 'some css
class']]
],
'items' => [
[
'label' => 'Subitem 1',
'url' => ['/subitemUrl1'],
'icon' => 'subitem1-icon'
],
[
'label' => 'Subitem 2',
'url' => ['/subitemUrl2'],
'icon' => 'subitem1-icon'
],
],
]
Copy link
Member

@fps01 fps01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
Please fix some implementation.

@@ -1,7 +1,7 @@
<?php
/**
* @copyright Copyright (c) 2015 Yiister
* @license https://github.com/yiister/yii2-adminlte/blob/master/LICENSE
* @license https://github.com/yiister/adminlte/blob/master/LICENSE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong link

@@ -21,7 +21,7 @@ class Menu extends \yii\widgets\Menu
/**
* @inheritdoc
*/
public $linkTemplate = '<a href="{url}">{icon}<span>{label}</span>{badge}</a>';
public $linkTemplate = '<a href="{url}">{icon}<span>{label}</span><span class="pull-right-container">{dropDownIcon}{badges}</span></a>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement dropDownIcon feature at the another pull request please.

$badgeOptions = ArrayHelper::getValue($badge, 'badgeOptions', []);
Html::addCssClass($badgeOptions, 'label pull-right');
$badges .= Html::tag('small', $badgeContent, $badgeOptions);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we have no array? This feature breaks a backward compatibility.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that using of badge placeholder is a better solution for it. What do you think?

@fps01 fps01 self-assigned this Dec 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants