Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
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
PSDI Army
yii2
Commits
c2ef433e
Commit
c2ef433e
authored
Nov 26, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4146: Added `yii\bootstrap\ButtonDropdown::$containerOptions`
parent
e6450be6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
2 deletions
+48
-2
ButtonDropdown.php
extensions/bootstrap/ButtonDropdown.php
+16
-2
CHANGELOG.md
extensions/bootstrap/CHANGELOG.md
+1
-0
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
ButtonDropdownTest.php
tests/unit/extensions/bootstrap/ButtonDropdownTest.php
+29
-0
TabsTest.php
tests/unit/extensions/bootstrap/TabsTest.php
+1
-0
No files found.
extensions/bootstrap/ButtonDropdown.php
View file @
c2ef433e
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
namespace
yii\bootstrap
;
namespace
yii\bootstrap
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
...
@@ -38,6 +39,15 @@ class ButtonDropdown extends Widget
...
@@ -38,6 +39,15 @@ class ButtonDropdown extends Widget
*/
*/
public
$label
=
'Button'
;
public
$label
=
'Button'
;
/**
/**
* @var array the HTML attributes for the container tag. The following special options are recognized:
*
* - tag: string, defaults to "div", the name of the container tag.
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @since 2.0.1
*/
public
$containerOptions
=
[];
/**
* @var array the HTML attributes of the button.
* @var array the HTML attributes of the button.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
*/
...
@@ -65,10 +75,14 @@ class ButtonDropdown extends Widget
...
@@ -65,10 +75,14 @@ class ButtonDropdown extends Widget
*/
*/
public
function
run
()
public
function
run
()
{
{
echo
Html
::
beginTag
(
'div'
,
[
'class'
=>
'btn-group'
]);
Html
::
addCssClass
(
$this
->
containerOptions
,
'btn-group'
);
$options
=
$this
->
containerOptions
;
$tag
=
ArrayHelper
::
remove
(
$options
,
'tag'
,
'div'
);
echo
Html
::
beginTag
(
$tag
,
$this
->
containerOptions
);
echo
"
\n
"
.
$this
->
renderButton
();
echo
"
\n
"
.
$this
->
renderButton
();
echo
"
\n
"
.
$this
->
renderDropdown
();
echo
"
\n
"
.
$this
->
renderDropdown
();
echo
"
\n
"
.
Html
::
endTag
(
'div'
);
echo
"
\n
"
.
Html
::
endTag
(
$tag
);
$this
->
registerPlugin
(
'button'
);
$this
->
registerPlugin
(
'button'
);
}
}
...
...
extensions/bootstrap/CHANGELOG.md
View file @
c2ef433e
...
@@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log
...
@@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Bug #5570:
`yii\bootstrap\Tabs`
would throw an exception if
`content`
is not set for one of its
`items`
(RomeroMsk)
-
Bug #5570:
`yii\bootstrap\Tabs`
would throw an exception if
`content`
is not set for one of its
`items`
(RomeroMsk)
-
Bug #6150:
`yii\bootstrap\Tabs`
dropdown IDs were generated incorrectly (samdark)
-
Bug #6150:
`yii\bootstrap\Tabs`
dropdown IDs were generated incorrectly (samdark)
-
Enh #4146: Added
`yii\bootstrap\ButtonDropdown::$containerOptions`
(samdark)
-
Enh #4181: Added
`yii\bootstrap\Modal::$headerOptions`
and
`yii\bootstrap\Modal::$footerOptions`
(tuxoff, samdark)
-
Enh #4181: Added
`yii\bootstrap\Modal::$headerOptions`
and
`yii\bootstrap\Modal::$footerOptions`
(tuxoff, samdark)
-
Enh #4450: Added
`yii\bootstrap\Nav::renderDropdown()`
(qiangxue)
-
Enh #4450: Added
`yii\bootstrap\Nav::renderDropdown()`
(qiangxue)
-
Enh #5735: Added
`yii\bootstrap\Tabs::renderTabContent`
to support manually rendering tab contents (RomeroMsk)
-
Enh #5735: Added
`yii\bootstrap\Tabs::renderTabContent`
to support manually rendering tab contents (RomeroMsk)
...
...
framework/CHANGELOG.md
View file @
c2ef433e
...
@@ -40,6 +40,7 @@ Yii Framework 2 Change Log
...
@@ -40,6 +40,7 @@ Yii Framework 2 Change Log
-
Bug: Gii console command help information does not contain global options (qiangxue)
-
Bug: Gii console command help information does not contain global options (qiangxue)
-
Bug:
`yii\web\UrlRule`
was unable to create URLs for rules containing unicode characters (samdark)
-
Bug:
`yii\web\UrlRule`
was unable to create URLs for rules containing unicode characters (samdark)
-
Bug:
`yii\web\AssetManager`
should not publish disabled asset bundles (qiangxue)
-
Bug:
`yii\web\AssetManager`
should not publish disabled asset bundles (qiangxue)
-
Enh #4146: Added
`yii\bootstrap\ButtonDropdown::$containerOptions`
(samdark)
-
Enh #4181: Added
`yii\bootstrap\Modal::$headerOptions`
and
`yii\bootstrap\Modal::$footerOptions`
(tuxoff, samdark)
-
Enh #4181: Added
`yii\bootstrap\Modal::$headerOptions`
and
`yii\bootstrap\Modal::$footerOptions`
(tuxoff, samdark)
-
Enh #4263: Added migration and SQL schema files for
`yii\log\DbTarget`
(samdark)
-
Enh #4263: Added migration and SQL schema files for
`yii\log\DbTarget`
(samdark)
-
Enh #4450: Added
`yii\bootstrap\Nav::renderDropdown()`
(qiangxue)
-
Enh #4450: Added
`yii\bootstrap\Nav::renderDropdown()`
(qiangxue)
...
...
tests/unit/extensions/bootstrap/ButtonDropdownTest.php
0 → 100644
View file @
c2ef433e
<?php
namespace
yiiunit\extensions\bootstrap
;
use
yii\bootstrap\ButtonDropdown
;
class
ButtonDropdownTest
extends
BootstrapTestCase
{
public
function
testContainerOptions
()
{
$containerClass
=
"dropup"
;
ButtonDropdown
::
$counter
=
0
;
$out
=
ButtonDropdown
::
widget
([
'containerOptions'
=>
[
'class'
=>
$containerClass
,
],
'label'
=>
'Action'
,
'dropdown'
=>
[
'items'
=>
[
[
'label'
=>
'DropdownA'
,
'url'
=>
'/'
],
[
'label'
=>
'DropdownB'
,
'url'
=>
'#'
],
],
],
]);
$this
->
assertContains
(
"
$containerClass
btn-group"
,
$out
);
}
}
\ No newline at end of file
tests/unit/extensions/bootstrap/TabsTest.php
View file @
c2ef433e
...
@@ -15,6 +15,7 @@ class TabsTest extends BootstrapTestCase
...
@@ -15,6 +15,7 @@ class TabsTest extends BootstrapTestCase
*/
*/
public
function
testIds
()
public
function
testIds
()
{
{
Tabs
::
$counter
=
0
;
$out
=
Tabs
::
widget
([
$out
=
Tabs
::
widget
([
'items'
=>
[
'items'
=>
[
[
[
...
...
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