Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
yii2bootstrap
Commits
05253b8f
Commit
05253b8f
authored
May 25, 2015
by
Francesc Bautista
Committed by
Alexander Makarov
May 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items
parent
ffa6d556
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
Nav.php
Nav.php
+2
-0
NavTest.php
tests/NavTest.php
+39
-0
No files found.
CHANGELOG.md
View file @
05253b8f
...
@@ -10,6 +10,7 @@ Yii Framework 2 bootstrap extension Change Log
...
@@ -10,6 +10,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Enh #42: Added support for the glyphicons via
`yii\bootstrap\Html::icon()`
(klimov-paul)
-
Enh #42: Added support for the glyphicons via
`yii\bootstrap\Html::icon()`
(klimov-paul)
-
Enh #43: Added support for the static form controls via
`yii\bootstrap\Html`
(klimov-paul)
-
Enh #43: Added support for the static form controls via
`yii\bootstrap\Html`
(klimov-paul)
-
Enh #44: Fixed
`yii\bootstrap\ButtonDropdown`
renders two buttons have same with id if 'split' is enabled (klimov-paul)
-
Enh #44: Fixed
`yii\bootstrap\ButtonDropdown`
renders two buttons have same with id if 'split' is enabled (klimov-paul)
-
Enh #50: Added
`dropDownOptions`
that is passed to
`yii\bootstrap\Nav`
dropdown items (fbau123)
2.0.4 May 10, 2015
2.0.4 May 10, 2015
...
...
Nav.php
View file @
05253b8f
...
@@ -63,6 +63,7 @@ class Nav extends Widget
...
@@ -63,6 +63,7 @@ class Nav extends Widget
* - linkOptions: array, optional, the HTML attributes of the item's link.
* - linkOptions: array, optional, the HTML attributes of the item's link.
* - options: array, optional, the HTML attributes of the item container (LI).
* - options: array, optional, the HTML attributes of the item container (LI).
* - active: boolean, optional, whether the item should be on active state or not.
* - active: boolean, optional, whether the item should be on active state or not.
* - dropDownOptions: array, optional, the HTML options that will passed to the [[Dropdown]] widget.
* - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget,
* - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget,
* or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.
* or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.
*
*
...
@@ -208,6 +209,7 @@ class Nav extends Widget
...
@@ -208,6 +209,7 @@ class Nav extends Widget
protected
function
renderDropdown
(
$items
,
$parentItem
)
protected
function
renderDropdown
(
$items
,
$parentItem
)
{
{
return
Dropdown
::
widget
([
return
Dropdown
::
widget
([
'options'
=>
ArrayHelper
::
getValue
(
$parentItem
,
'dropDownOptions'
,
[]),
'items'
=>
$items
,
'items'
=>
$items
,
'encodeLabels'
=>
$this
->
encodeLabels
,
'encodeLabels'
=>
$this
->
encodeLabels
,
'clientOptions'
=>
false
,
'clientOptions'
=>
false
,
...
...
tests/NavTest.php
View file @
05253b8f
...
@@ -43,6 +43,45 @@ class NavTest extends TestCase
...
@@ -43,6 +43,45 @@ class NavTest extends TestCase
<ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="w1" class="dropdown-menu"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li></ul>
<li class="dropdown-header">Page3</li></ul></li></ul>
EXPECTED;
$this
->
assertEqualsWithoutLE
(
$expected
,
$out
);
}
public
function
testRenderDropDownWithDropDownOptions
()
{
Nav
::
$counter
=
0
;
$out
=
Nav
::
widget
(
[
'items'
=>
[
[
'label'
=>
'Page1'
,
'content'
=>
'Page1'
,
],
[
'label'
=>
'Dropdown1'
,
'dropDownOptions'
=>
[
'class'
=>
'test'
,
'data-id'
=>
't1'
,
'id'
=>
'test1'
],
'items'
=>
[
[
'label'
=>
'Page2'
,
'content'
=>
'Page2'
],
[
'label'
=>
'Page3'
,
'content'
=>
'Page3'
],
]
],
[
'label'
=>
'Dropdown2'
,
'visible'
=>
false
,
'items'
=>
[
[
'label'
=>
'Page4'
,
'content'
=>
'Page4'
],
[
'label'
=>
'Page5'
,
'content'
=>
'Page5'
],
]
]
]
]
);
$expected
=
<<<EXPECTED
<ul id="w0" class="nav"><li><a href="#">Page1</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Dropdown1 <b class="caret"></b></a><ul id="test1" class="test dropdown-menu" data-id="t1"><li class="dropdown-header">Page2</li>
<li class="dropdown-header">Page3</li></ul></li></ul>
EXPECTED;
EXPECTED;
$this
->
assertEqualsWithoutLE
(
$expected
,
$out
);
$this
->
assertEqualsWithoutLE
(
$expected
,
$out
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment