-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: master
Are you sure you want to change the base?
Conversation
…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' ], ], ]
There was a problem hiding this 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 |
There was a problem hiding this comment.
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>'; |
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
…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' ], ], ]