Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
Yii Bootstrap 3
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Common
Yii Bootstrap 3
Commits
5d6589fd
Commit
5d6589fd
authored
Dec 21, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with publishing assets in the Bootstrap component
parent
2d732769
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
Bootstrap.php
components/Bootstrap.php
+22
-19
main.php
theme/views/layouts/main.php
+2
-0
No files found.
components/Bootstrap.php
View file @
5d6589fd
...
...
@@ -37,7 +37,7 @@ class Bootstrap extends CApplicationComponent
/**
* @var boolean indicates whether assets should be republished on every request.
*/
public
$
publishAssets
=
YII_DEBUG
;
public
$
forceCopyAssets
=
false
;
protected
$_assetsUrl
;
...
...
@@ -96,7 +96,6 @@ class Bootstrap extends CApplicationComponent
/**
* Registers the Bootstrap JavaScript.
* @param int $position the position of the JavaScript code.
* @see CClientScript::registerScriptFile
*/
protected
function
registerJS
(
$position
=
CClientScript
::
POS_HEAD
)
{
...
...
@@ -108,6 +107,16 @@ class Bootstrap extends CApplicationComponent
}
/**
* Registers all Bootstrap CSS and JavaScript.
* @since 2.1.0
*/
public
function
register
()
{
$this
->
registerAllCss
();
$this
->
registerCoreScripts
();
}
/**
* Registers the Bootstrap affix plugin.
* @param string $selector the CSS selector
* @param array $options the plugin options
...
...
@@ -264,26 +273,20 @@ class Bootstrap extends CApplicationComponent
* @param string $defaultSelector the default CSS selector
* @since 0.9.8
*/
protected
function
registerPlugin
(
$name
,
$selector
=
null
,
$options
=
array
()
,
$defaultSelector
=
null
)
protected
function
registerPlugin
(
$name
,
$selector
=
null
,
$options
=
array
())
{
if
(
!
isset
(
$selector
)
&&
empty
(
$options
))
{
// Initialization from extension configuration.
$config
=
isset
(
$this
->
plugins
[
$name
])
?
$this
->
plugins
[
$name
]
:
array
();
// Initialization from extension configuration.
$config
=
isset
(
$this
->
plugins
[
$name
])
?
$this
->
plugins
[
$name
]
:
array
();
if
(
isset
(
$config
[
'selector'
]))
$selector
=
$config
[
'selector'
];
if
(
$selector
===
null
&&
isset
(
$config
[
'selector'
]))
$selector
=
$config
[
'selector'
];
if
(
isset
(
$config
[
'options'
]))
$options
=
!
empty
(
$options
)
?
CMap
::
mergeArray
(
$config
[
'options'
],
$options
)
:
$config
[
'options'
];
if
(
!
isset
(
$selector
))
$selector
=
$defaultSelector
;
}
if
(
isset
(
$config
[
'options'
]))
$options
=
!
empty
(
$options
)
?
CMap
::
mergeArray
(
$options
,
$config
[
'options'
])
:
$config
[
'options'
];
if
(
isset
(
$selector
)
)
if
(
$selector
!==
null
)
{
$key
=
__CLASS__
.
'.'
.
md5
(
$name
.
$selector
.
serialize
(
$options
)
.
$defaultSelector
);
$key
=
__CLASS__
.
'.'
.
md5
(
$name
.
$selector
.
serialize
(
$options
));
$options
=
!
empty
(
$options
)
?
CJavaScript
::
encode
(
$options
)
:
''
;
Yii
::
app
()
->
clientScript
->
registerScript
(
$key
,
"jQuery('
{
$selector
}
').
{
$name
}
(
{
$options
}
);"
);
}
...
...
@@ -300,7 +303,7 @@ class Bootstrap extends CApplicationComponent
else
{
$assetsPath
=
Yii
::
getPathOfAlias
(
'bootstrap.assets'
);
$assetsUrl
=
Yii
::
app
()
->
assetManager
->
publish
(
$assetsPath
,
true
,
-
1
,
$this
->
publish
Assets
);
$assetsUrl
=
Yii
::
app
()
->
assetManager
->
publish
(
$assetsPath
,
true
,
-
1
,
$this
->
forceCopy
Assets
);
return
$this
->
_assetsUrl
=
$assetsUrl
;
}
}
...
...
@@ -311,6 +314,6 @@ class Bootstrap extends CApplicationComponent
*/
public
function
getVersion
()
{
return
'2.
0
.0'
;
return
'2.
1
.0'
;
}
}
theme/views/layouts/main.php
View file @
5d6589fd
...
...
@@ -8,6 +8,8 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<?php
echo
Yii
::
app
()
->
theme
->
baseUrl
;
?>
/css/styles.css"
/>
<title>
<?php
echo
CHtml
::
encode
(
$this
->
pageTitle
);
?>
</title>
<?php
Yii
::
app
()
->
bootstrap
->
register
();
?>
</head>
<body>
...
...
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