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
72854898
Commit
72854898
authored
Feb 10, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled scrollspy and updated the demo.
parent
31aaada1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
41 deletions
+73
-41
Bootstrap.php
components/Bootstrap.php
+20
-10
styles.less
demo/less/styles.less
+7
-0
SiteController.php
demo/protected/controllers/SiteController.php
+1
-1
column1.php
demo/protected/views/layouts/column1.php
+2
-5
column2.php
demo/protected/views/layouts/column2.php
+18
-15
main.php
demo/protected/views/layouts/main.php
+3
-5
index.php
demo/protected/views/site/index.php
+0
-0
BootMenu.php
widgets/BootMenu.php
+22
-5
No files found.
components/Bootstrap.php
View file @
72854898
...
...
@@ -184,15 +184,6 @@ class Bootstrap extends CApplicationComponent
public
function
registerScrollSpy
(
$selector
=
null
,
$options
=
array
())
{
$this
->
registerPlugin
(
self
::
PLUGIN_SCROLLSPY
,
$selector
,
$options
);
if
(
!
isset
(
$selector
))
{
$selector
=
isset
(
$this
->
plugins
[
self
::
PLUGIN_SCROLLSPY
],
$this
->
plugins
[
self
::
PLUGIN_SCROLLSPY
][
'selector'
])
?
$this
->
plugins
[
self
::
PLUGIN_SCROLLSPY
][
'selector'
]
:
'body'
;
}
Yii
::
app
()
->
clientScript
->
registerScript
(
__CLASS__
.
'.scrollspy'
,
"jQuery(
{
$selector
}
).attr('data-spy', 'scroll');"
);
}
/**
...
...
@@ -245,6 +236,25 @@ class Bootstrap extends CApplicationComponent
}
/**
* Sets the target element for the scrollspy.
* @param string $selector the CSS selector
* @param string $target the target CSS selector
* @param string $offset the offset
*/
public
function
spyOn
(
$selector
,
$target
=
null
,
$offset
=
null
)
{
$script
=
"jQuery('
{
$selector
}
').attr('data-spy', 'scroll');"
;
if
(
isset
(
$target
))
$script
.=
"jQuery('
{
$selector
}
').attr('data-target', '
{
$target
}
');"
;
if
(
isset
(
$offset
))
$script
.=
"jQuery('
{
$selector
}
').attr('data-offset', '
{
$offset
}
');"
;
Yii
::
app
()
->
clientScript
->
registerScript
(
__CLASS__
.
'.spyOn.'
.
$selector
,
$script
);
}
/**
* Returns whether a plugin is disabled in the plugin configuration.
* @param string $name the name of the plugin
* @return boolean the result
...
...
@@ -260,7 +270,7 @@ class Bootstrap extends CApplicationComponent
* @param string $name the name of the plugin
* @param string $selector the CSS selector
* @param array $options the plugin options
* @param string $defaultSelector the default
selector to use
* @param string $defaultSelector the default
CSS selector
* @since 0.9.8
*/
protected
function
registerPlugin
(
$name
,
$selector
=
null
,
$options
=
array
(),
$defaultSelector
=
null
)
...
...
demo/less/styles.less
View file @
72854898
...
...
@@ -77,6 +77,13 @@ section {
font-weight: bold;
}
#subnav {
left: 20px;
position: fixed;
top: 60px;
width: 270px;
}
// POST-IMPORTS
// Responsive style must be included after the body padding has been set.
...
...
demo/protected/controllers/SiteController.php
View file @
72854898
...
...
@@ -48,7 +48,7 @@ class SiteController extends Controller
$rawData
[]
=
array
(
'id'
=>
$i
+
1
);
$listDataProvider
=
new
CArrayDataProvider
(
$rawData
,
array
(
'pagination'
=>
array
(
'pageSize'
=>
9
),
'pagination'
=>
array
(
'pageSize'
=>
12
),
));
$parser
=
new
CMarkdownParser
();
...
...
demo/protected/views/layouts/column1.php
View file @
72854898
<?php
$this
->
beginContent
(
'//layouts/main'
);
?>
<div
class=
"span12"
>
<?php
echo
$content
;
?>
</div>
<?php
echo
$content
;
?>
<?php
$this
->
endContent
();
?>
\ No newline at end of file
demo/protected/views/layouts/column2.php
View file @
72854898
<?php
$this
->
beginContent
(
'//layouts/main'
);
?>
<div
class=
"span8"
>
<?php
echo
$content
;
?>
</div>
<div
class=
"row"
>
<div
class=
"span8"
>
<?php
echo
$content
;
?>
</div>
<div
class=
"span4"
>
<?php
$this
->
beginWidget
(
'zii.widgets.CPortlet'
,
array
(
'title'
=>
'Operations'
,
));
$this
->
widget
(
'zii.widgets.CMenu'
,
array
(
'items'
=>
$this
->
menu
,
'htmlOptions'
=>
array
(
'class'
=>
'operations'
),
));
$this
->
endWidget
();
?>
</div>
<div
class=
"span4"
>
<?php
$this
->
beginWidget
(
'zii.widgets.CPortlet'
,
array
(
'title'
=>
'Operations'
,
));
$this
->
widget
(
'zii.widgets.CMenu'
,
array
(
'items'
=>
$this
->
menu
,
'htmlOptions'
=>
array
(
'class'
=>
'operations'
),
));
$this
->
endWidget
();
?>
</div>
<?php
$this
->
endContent
();
?>
\ No newline at end of file
demo/protected/views/layouts/main.php
View file @
72854898
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xml:lang=
"en"
lang=
"en"
>
<!
doctype html
>
<html>
<head>
<title>
<?php
echo
CHtml
::
encode
(
$this
->
pageTitle
);
?>
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
...
...
@@ -54,9 +54,7 @@
));
?>
<?php
endif
?>
<div
class=
"row"
>
<?php
echo
$content
;
?>
</div>
<?php
echo
$content
;
?>
<hr
/>
...
...
demo/protected/views/site/index.php
View file @
72854898
This diff is collapsed.
Click to expand it.
widgets/BootMenu.php
View file @
72854898
...
...
@@ -13,6 +13,7 @@ Yii::import('bootstrap.widgets.BootWidget');
* Bootstrap menu widget.
* Used for rendering of bootstrap menus with support dropdown sub-menus and scroll-spying.
* @since 0.9.8
* @todo Fix scrollspy.
*/
class
BootMenu
extends
BootWidget
{
...
...
@@ -32,9 +33,9 @@ class BootMenu extends BootWidget
*/
public
$stacked
=
false
;
/**
* @var
boolean whether to enable the scroll-spy
.
* @var
array the scroll-spy configuration
.
*/
public
$scrollspy
=
false
;
public
$scrollspy
;
/**
* @var array the menu items.
*/
...
...
@@ -88,10 +89,26 @@ class BootMenu extends BootWidget
$this
->
renderItems
(
$this
->
items
);
echo
'</ul>'
;
Yii
::
app
()
->
bootstrap
->
registerDropdown
();
/** @var Bootstrap $bootstrap */
$bootstrap
=
Yii
::
app
()
->
bootstrap
;
$bootstrap
->
registerDropdown
();
if
(
$this
->
scrollspy
)
Yii
::
app
()
->
bootstrap
->
registerScrollSpy
(
'#'
.
$this
->
id
);
/*
if (isset($this->scrollspy))
{
if (!is_array($this->scrollspy))
$this->scrollspy = array();
if (!isset($this->scrollspy['target']))
$this->scrollspy['target'] = 'body';
if (!isset($this->scrollspy['offset']))
$this->scrollspy['offset'] = null;
$bootstrap->registerScrollSpy();
$bootstrap->spyOn($this->scrollspy['target'], '#'.$this->id, $this->scrollspy['offset']);
}
*/
}
}
...
...
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