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
b6b3e7fd
Commit
b6b3e7fd
authored
May 22, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #352 from creocoder/bootstrap-refactoring
`yii\bootstrap\*` another refactioring
parents
b317c082
c5e93efd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
Modal.php
framework/yii/bootstrap/Modal.php
+2
-2
TypeAhead.php
framework/yii/bootstrap/TypeAhead.php
+5
-6
Widget.php
framework/yii/bootstrap/Widget.php
+6
-6
No files found.
framework/yii/bootstrap/Modal.php
View file @
b6b3e7fd
...
@@ -217,9 +217,9 @@ class Modal extends Widget
...
@@ -217,9 +217,9 @@ class Modal extends Widget
),
$this
->
options
);
),
$this
->
options
);
$this
->
addCssClass
(
$this
->
options
,
'modal'
);
$this
->
addCssClass
(
$this
->
options
,
'modal'
);
$this
->
plugin
Options
=
array_merge
(
array
(
$this
->
client
Options
=
array_merge
(
array
(
'show'
=>
false
,
'show'
=>
false
,
),
$this
->
plugin
Options
);
),
$this
->
client
Options
);
if
(
$this
->
closeButton
!==
null
)
{
if
(
$this
->
closeButton
!==
null
)
{
$this
->
closeButton
=
array_merge
(
array
(
$this
->
closeButton
=
array_merge
(
array
(
...
...
framework/yii/bootstrap/TypeAhead.php
View file @
b6b3e7fd
...
@@ -19,10 +19,9 @@ use yii\helpers\Html;
...
@@ -19,10 +19,9 @@ use yii\helpers\Html;
*
*
* ```php
* ```php
* echo TypeAhead::widget(array(
* echo TypeAhead::widget(array(
* 'form' => $form,
* 'model' => $model,
* 'model' => $model,
* 'attribute' => 'country',
* 'attribute' => 'country',
* '
plugin
Options' => array(
* '
client
Options' => array(
* 'source' => array('USA', 'ESP'),
* 'source' => array('USA', 'ESP'),
* ),
* ),
* ));
* ));
...
@@ -33,7 +32,7 @@ use yii\helpers\Html;
...
@@ -33,7 +32,7 @@ use yii\helpers\Html;
* ```php
* ```php
* echo TypeAhead::widget(array(
* echo TypeAhead::widget(array(
* 'name' => 'country',
* 'name' => 'country',
* '
plugin
Options' => array(
* '
cloent
Options' => array(
* 'source' => array('USA', 'ESP'),
* 'source' => array('USA', 'ESP'),
* ),
* ),
* ));
* ));
...
@@ -77,8 +76,8 @@ class TypeAhead extends Widget
...
@@ -77,8 +76,8 @@ class TypeAhead extends Widget
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to
* the [[name]] attribute.
* the [[name]] attribute.
* @return string the rendering result
* @return string the rendering result
* @throws InvalidConfigException when none of the required attributes are set to render the textInput.
That is,
* @throws InvalidConfigException when none of the required attributes are set to render the textInput.
* if [[model]] and [[attribute]] are not set, then [[name]] is required.
*
That is,
if [[model]] and [[attribute]] are not set, then [[name]] is required.
*/
*/
public
function
renderField
()
public
function
renderField
()
{
{
...
@@ -87,7 +86,7 @@ class TypeAhead extends Widget
...
@@ -87,7 +86,7 @@ class TypeAhead extends Widget
}
elseif
(
$this
->
name
!==
null
)
{
}
elseif
(
$this
->
name
!==
null
)
{
return
Html
::
textInput
(
$this
->
name
,
$this
->
value
,
$this
->
options
);
return
Html
::
textInput
(
$this
->
name
,
$this
->
value
,
$this
->
options
);
}
else
{
}
else
{
throw
new
InvalidConfigException
(
'Either "name" or "model" and "attribute" properties must be specified.'
);
throw
new
InvalidConfigException
(
"Either 'name' or 'model' and 'attribute' properties must be specified."
);
}
}
}
}
}
}
framework/yii/bootstrap/Widget.php
View file @
b6b3e7fd
...
@@ -35,14 +35,14 @@ class Widget extends \yii\base\Widget
...
@@ -35,14 +35,14 @@ class Widget extends \yii\base\Widget
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* how to use the "Modal" plugin and the supported options (e.g. "remote").
* how to use the "Modal" plugin and the supported options (e.g. "remote").
*/
*/
public
$
plugin
Options
=
array
();
public
$
client
Options
=
array
();
/**
/**
* @var array the event handlers for the underlying Bootstrap JS plugin.
* @var array the event handlers for the underlying Bootstrap JS plugin.
* Please refer to the corresponding Bootstrap plugin Web page for possible events.
* Please refer to the corresponding Bootstrap plugin Web page for possible events.
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* For example, [this page](http://twitter.github.io/bootstrap/javascript.html#modals) shows
* how to use the "Modal" plugin and the supported events (e.g. "shown").
* how to use the "Modal" plugin and the supported events (e.g. "shown").
*/
*/
public
$
plugin
Events
=
array
();
public
$
client
Events
=
array
();
/**
/**
...
@@ -69,15 +69,15 @@ class Widget extends \yii\base\Widget
...
@@ -69,15 +69,15 @@ class Widget extends \yii\base\Widget
$view
->
registerAssetBundle
(
static
::
$responsive
?
'yii/bootstrap/responsive'
:
'yii/bootstrap'
);
$view
->
registerAssetBundle
(
static
::
$responsive
?
'yii/bootstrap/responsive'
:
'yii/bootstrap'
);
$view
->
registerAssetBundle
(
"yii/bootstrap/
$name
"
);
$view
->
registerAssetBundle
(
"yii/bootstrap/
$name
"
);
if
(
$this
->
plugin
Options
!==
false
)
{
if
(
$this
->
client
Options
!==
false
)
{
$options
=
empty
(
$this
->
pluginOptions
)
?
''
:
Json
::
encode
(
$this
->
plugin
Options
);
$options
=
empty
(
$this
->
clientOptions
)
?
''
:
Json
::
encode
(
$this
->
client
Options
);
$js
=
"jQuery('#
$id
').
$name
(
$options
);"
;
$js
=
"jQuery('#
$id
').
$name
(
$options
);"
;
$view
->
registerJs
(
$js
);
$view
->
registerJs
(
$js
);
}
}
if
(
!
empty
(
$this
->
plugin
Events
))
{
if
(
!
empty
(
$this
->
client
Events
))
{
$js
=
array
();
$js
=
array
();
foreach
(
$this
->
plugin
Events
as
$event
=>
$handler
)
{
foreach
(
$this
->
client
Events
as
$event
=>
$handler
)
{
$js
[]
=
"jQuery('#
$id
').on('
$event
',
$handler
);"
;
$js
[]
=
"jQuery('#
$id
').on('
$event
',
$handler
);"
;
}
}
$view
->
registerJs
(
implode
(
"
\n
"
,
$js
));
$view
->
registerJs
(
implode
(
"
\n
"
,
$js
));
...
...
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