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
a7a92824
Commit
a7a92824
authored
Jul 12, 2016
by
Carsten Brandt
Committed by
GitHub
Jul 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #142 from Okeanos/master
Allow URLs to be used as Dropdown items in Tab Widgets #113
parents
cfe46a2c
72a9bf38
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
CHANGELOG.md
CHANGELOG.md
+1
-0
Tabs.php
Tabs.php
+9
-2
TabsTest.php
tests/TabsTest.php
+14
-2
No files found.
CHANGELOG.md
View file @
a7a92824
...
@@ -7,6 +7,7 @@ Yii Framework 2 bootstrap extension Change Log
...
@@ -7,6 +7,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Bug #126:
`yii\bootstrap\ToggleButtonGroup`
was unable to work without model (makroxyz)
-
Bug #126:
`yii\bootstrap\ToggleButtonGroup`
was unable to work without model (makroxyz)
-
Bug #130: Fixed
`yii\bootstrap\Collapse`
to use pure numerical value on
`content`
property (meysampg)
-
Bug #130: Fixed
`yii\bootstrap\Collapse`
to use pure numerical value on
`content`
property (meysampg)
-
Bug #137: Remove
`role="navbar"`
from
`yii\bootstrap\NavBar`
according to new aria specification (tino415)
-
Bug #137: Remove
`role="navbar"`
from
`yii\bootstrap\NavBar`
according to new aria specification (tino415)
-
Enh #113: Allow URLs instead of content for Tab Widget Dropdown items (Okeanos)
2.
0.6 March 17, 2016
2.
0.6 March 17, 2016
--------------------
--------------------
...
...
Tabs.php
View file @
a7a92824
...
@@ -44,6 +44,10 @@ use yii\helpers\ArrayHelper;
...
@@ -44,6 +44,10 @@ use yii\helpers\ArrayHelper;
* 'label' => 'DropdownB',
* 'label' => 'DropdownB',
* 'content' => 'DropdownB, Anim pariatur cliche...',
* 'content' => 'DropdownB, Anim pariatur cliche...',
* ],
* ],
* [
* 'label' => 'External Link',
* 'url' => 'http://www.example.com',
* ],
* ],
* ],
* ],
* ],
* ],
* ],
...
@@ -240,8 +244,11 @@ class Tabs extends Widget
...
@@ -240,8 +244,11 @@ class Tabs extends Widget
if
(
isset
(
$item
[
'visible'
])
&&
!
$item
[
'visible'
])
{
if
(
isset
(
$item
[
'visible'
])
&&
!
$item
[
'visible'
])
{
continue
;
continue
;
}
}
if
(
!
array_key_exists
(
'content'
,
$item
))
{
if
(
!
(
array_key_exists
(
'content'
,
$item
)
xor
array_key_exists
(
'url'
,
$item
)))
{
throw
new
InvalidConfigException
(
"The 'content' option is required."
);
throw
new
InvalidConfigException
(
"Either the 'content' or the 'url' option is required, but only one can be set."
);
}
if
(
array_key_exists
(
'url'
,
$item
))
{
continue
;
}
}
$content
=
ArrayHelper
::
remove
(
$item
,
'content'
);
$content
=
ArrayHelper
::
remove
(
$item
,
'content'
);
...
...
tests/TabsTest.php
View file @
a7a92824
...
@@ -39,7 +39,13 @@ class TabsTest extends TestCase
...
@@ -39,7 +39,13 @@ class TabsTest extends TestCase
]
]
],
],
[
[
'label'
=>
$extAnchor
=
'External link'
,
'url'
=>
$extUrl
=
[
'//other/route'
],
'label'
=>
$extAnchor1
=
'External link'
,
'url'
=>
$extUrl1
=
[
'//other/route'
],
],
[
'label'
=>
'Dropdown3'
,
'items'
=>
[
[
'label'
=>
$extAnchor2
=
'External Dropdown Link'
,
'url'
=>
$extUrl2
=
[
'//other/dropdown/route'
]],
]
],
],
]
]
]);
]);
...
@@ -63,13 +69,16 @@ class TabsTest extends TestCase
...
@@ -63,13 +69,16 @@ class TabsTest extends TestCase
"#
$page4
"
,
// Page4
"#
$page4
"
,
// Page4
"#
$page5
"
,
// Page5
"#
$page5
"
,
// Page5
'w3'
,
// Dropdown3
// containers
// containers
"id=
\"
$page1
\"
"
,
"id=
\"
$page1
\"
"
,
"id=
\"
$page2
\"
"
,
"id=
\"
$page2
\"
"
,
"id=
\"
$page3
\"
"
,
"id=
\"
$page3
\"
"
,
"id=
\"
$page4
\"
"
,
"id=
\"
$page4
\"
"
,
"id=
\"
$page5
\"
"
,
"id=
\"
$page5
\"
"
,
Html
::
a
(
$extAnchor
,
$extUrl
),
Html
::
a
(
$extAnchor1
,
$extUrl1
),
Html
::
a
(
$extAnchor2
,
$extUrl2
,
[
'tabindex'
=>
-
1
]),
];
];
foreach
(
$shouldContain
as
$string
)
{
foreach
(
$shouldContain
as
$string
)
{
...
@@ -96,6 +105,8 @@ class TabsTest extends TestCase
...
@@ -96,6 +105,8 @@ class TabsTest extends TestCase
[
'label'
=>
'Page2'
,
'content'
=>
'Page2'
],
[
'label'
=>
'Page2'
,
'content'
=>
'Page2'
],
[
'label'
=>
'InvisibleItem'
,
'content'
=>
'Invisible Item Content'
,
'visible'
=>
false
],
[
'label'
=>
'InvisibleItem'
,
'content'
=>
'Invisible Item Content'
,
'visible'
=>
false
],
[
'label'
=>
'Page3'
,
'content'
=>
'Page3'
],
[
'label'
=>
'Page3'
,
'content'
=>
'Page3'
],
[
'label'
=>
'External Link'
,
'url'
=>
[
'//other/dropdown/route'
]],
[
'label'
=>
'Invisible External Link'
,
'url'
=>
[
'//other/dropdown/route'
],
'visible'
=>
false
],
]
]
],
],
]
]
...
@@ -105,6 +116,7 @@ class TabsTest extends TestCase
...
@@ -105,6 +116,7 @@ class TabsTest extends TestCase
$this
->
assertNotContains
(
'Invisible Page Content'
,
$html
);
$this
->
assertNotContains
(
'Invisible Page Content'
,
$html
);
$this
->
assertNotContains
(
'InvisibleItem'
,
$html
);
$this
->
assertNotContains
(
'InvisibleItem'
,
$html
);
$this
->
assertNotContains
(
'Invisible Item Content'
,
$html
);
$this
->
assertNotContains
(
'Invisible Item Content'
,
$html
);
$this
->
assertNotContains
(
'Invisible External Link'
,
$html
);
}
}
public
function
testItem
()
public
function
testItem
()
...
...
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