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
5ccdca17
Commit
5ccdca17
authored
Jan 01, 2015
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6672: `yii\bootstrap\Dropdown` should register client event handlers
parent
c27b2984
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
CHANGELOG.md
extensions/bootstrap/CHANGELOG.md
+1
-1
Dropdown.php
extensions/bootstrap/Dropdown.php
+1
-0
Widget.php
extensions/bootstrap/Widget.php
+11
-1
Widget.php
extensions/jui/Widget.php
+1
-1
No files found.
extensions/bootstrap/CHANGELOG.md
View file @
5ccdca17
...
...
@@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.
0.2 under development
-----------------------
-
no changes in this release.
-
Bug #6672:
`yii\bootstrap\Dropdown`
should register client event handlers (qiangxue)
2.0.1 December 07, 2014
...
...
extensions/bootstrap/Dropdown.php
View file @
5ccdca17
...
...
@@ -60,6 +60,7 @@ class Dropdown extends Widget
{
echo
$this
->
renderItems
(
$this
->
items
,
$this
->
options
);
BootstrapPluginAsset
::
register
(
$this
->
getView
());
$this
->
registerClientEvents
();
}
/**
...
...
extensions/bootstrap/Widget.php
View file @
5ccdca17
...
...
@@ -71,12 +71,22 @@ class Widget extends \yii\base\Widget
$view
->
registerJs
(
$js
);
}
$this
->
registerClientEvents
();
}
/**
* Registers JS event handlers that are listed in [[clientEvents]].
* @since 2.0.2
*/
protected
function
registerClientEvents
()
{
if
(
!
empty
(
$this
->
clientEvents
))
{
$id
=
$this
->
options
[
'id'
];
$js
=
[];
foreach
(
$this
->
clientEvents
as
$event
=>
$handler
)
{
$js
[]
=
"jQuery('#
$id
').on('
$event
',
$handler
);"
;
}
$
view
->
registerJs
(
implode
(
"
\n
"
,
$js
));
$
this
->
getView
()
->
registerJs
(
implode
(
"
\n
"
,
$js
));
}
}
}
extensions/jui/Widget.php
View file @
5ccdca17
...
...
@@ -48,7 +48,7 @@ class Widget extends \yii\base\Widget
public
$clientEvents
=
[];
/**
* @var array event names mapped to what should be specified in
.on(
* @var array event names mapped to what should be specified in
`.on()`.
* If empty, it is assumed that event passed to clientEvents is prefixed with widget name.
*/
protected
$clientEventMap
=
[];
...
...
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