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
554c3ccf
Commit
554c3ccf
authored
Apr 30, 2015
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for using external URLs for
parent
dc95bd56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
CHANGELOG.md
CHANGELOG.md
+1
-0
Tabs.php
Tabs.php
+14
-2
TabsTest.php
tests/TabsTest.php
+6
-1
No files found.
CHANGELOG.md
View file @
554c3ccf
...
@@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log
...
@@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Enh #2546: Added
`visible`
option to
`yii\bootstrap\ButtonGroup::$buttons`
(samdark, lukBarros)
-
Enh #2546: Added
`visible`
option to
`yii\bootstrap\ButtonGroup::$buttons`
(samdark, lukBarros)
-
Enh #7633: Added
`ActionColumn::$buttonOptions`
for defining HTML options to be added to the default buttons (cebe)
-
Enh #7633: Added
`ActionColumn::$buttonOptions`
for defining HTML options to be added to the default buttons (cebe)
-
Enh: Added
`Nav::$dropDownCaret`
to allow customization of the dropdown caret symbol (cebe)
-
Enh: Added
`Nav::$dropDownCaret`
to allow customization of the dropdown caret symbol (cebe)
-
Enh: Added support for using external URLs for
`Tabs`
. (dynasource, qiangxue)
2.0.3 March 01, 2015
2.0.3 March 01, 2015
...
...
Tabs.php
View file @
554c3ccf
...
@@ -31,6 +31,10 @@ use yii\helpers\Html;
...
@@ -31,6 +31,10 @@ use yii\helpers\Html;
* 'options' => ['id' => 'myveryownID'],
* 'options' => ['id' => 'myveryownID'],
* ],
* ],
* [
* [
* 'label' => 'Example',
* 'url' => 'http://www.example.com',
* ],
* [
* 'label' => 'Dropdown',
* 'label' => 'Dropdown',
* 'items' => [
* 'items' => [
* [
* [
...
@@ -63,6 +67,8 @@ class Tabs extends Widget
...
@@ -63,6 +67,8 @@ class Tabs extends Widget
* - headerOptions: array, optional, the HTML attributes of the tab header.
* - headerOptions: array, optional, the HTML attributes of the tab header.
* - linkOptions: array, optional, the HTML attributes of the tab header link tags.
* - linkOptions: array, optional, the HTML attributes of the tab header link tags.
* - content: string, optional, the content (HTML) of the tab pane.
* - content: string, optional, the content (HTML) of the tab pane.
* - url: string, optional, an external URL. When this is specified, clicking on this tab will bring
* the browser to this URL. This option is available since version 2.0.4.
* - options: array, optional, the HTML attributes of the tab pane container.
* - options: array, optional, the HTML attributes of the tab pane container.
* - active: boolean, optional, whether the item tab header and pane should be visible or not.
* - active: boolean, optional, whether the item tab header and pane should be visible or not.
* - items: array, optional, can be used instead of `content` to specify a dropdown items
* - items: array, optional, can be used instead of `content` to specify a dropdown items
...
@@ -171,8 +177,14 @@ class Tabs extends Widget
...
@@ -171,8 +177,14 @@ class Tabs extends Widget
Html
::
addCssClass
(
$options
,
'active'
);
Html
::
addCssClass
(
$options
,
'active'
);
Html
::
addCssClass
(
$headerOptions
,
'active'
);
Html
::
addCssClass
(
$headerOptions
,
'active'
);
}
}
$linkOptions
[
'data-toggle'
]
=
'tab'
;
$header
=
Html
::
a
(
$label
,
'#'
.
$options
[
'id'
],
$linkOptions
);
if
(
isset
(
$item
[
'url'
]))
{
$header
=
Html
::
a
(
$label
,
$item
[
'url'
],
$linkOptions
);
}
else
{
$linkOptions
[
'data-toggle'
]
=
'tab'
;
$header
=
Html
::
a
(
$label
,
'#'
.
$options
[
'id'
],
$linkOptions
);
}
if
(
$this
->
renderTabContent
)
{
if
(
$this
->
renderTabContent
)
{
$panes
[]
=
Html
::
tag
(
'div'
,
isset
(
$item
[
'content'
])
?
$item
[
'content'
]
:
''
,
$options
);
$panes
[]
=
Html
::
tag
(
'div'
,
isset
(
$item
[
'content'
])
?
$item
[
'content'
]
:
''
,
$options
);
}
}
...
...
tests/TabsTest.php
View file @
554c3ccf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
yiiunit\extensions\bootstrap
;
namespace
yiiunit\extensions\bootstrap
;
use
yii\bootstrap\Tabs
;
use
yii\bootstrap\Tabs
;
use
yii\helpers\Html
;
/**
/**
* Tests for Tabs widget
* Tests for Tabs widget
...
@@ -36,7 +37,10 @@ class TabsTest extends TestCase
...
@@ -36,7 +37,10 @@ class TabsTest extends TestCase
[
'label'
=>
'Page4'
,
'content'
=>
'Page4'
],
[
'label'
=>
'Page4'
,
'content'
=>
'Page4'
],
[
'label'
=>
'Page5'
,
'content'
=>
'Page5'
],
[
'label'
=>
'Page5'
,
'content'
=>
'Page5'
],
]
]
]
],
[
'label'
=>
$extAnchor
=
'External link'
,
'url'
=>
$extUrl
=
[
'//other/route'
],
],
]
]
]);
]);
...
@@ -65,6 +69,7 @@ class TabsTest extends TestCase
...
@@ -65,6 +69,7 @@ class TabsTest extends TestCase
"id=
\"
$page3
\"
"
,
"id=
\"
$page3
\"
"
,
"id=
\"
$page4
\"
"
,
"id=
\"
$page4
\"
"
,
"id=
\"
$page5
\"
"
,
"id=
\"
$page5
\"
"
,
Html
::
a
(
$extAnchor
,
$extUrl
),
];
];
foreach
(
$shouldContain
as
$string
)
{
foreach
(
$shouldContain
as
$string
)
{
...
...
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