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
dad11791
Commit
dad11791
authored
Mar 08, 2012
by
niskac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added option to disable js, refactored code and updated the demo
parent
9db95b04
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
134 additions
and
34 deletions
+134
-34
Bootstrap.php
components/Bootstrap.php
+9
-2
main.php
demo/protected/views/layouts/main.php
+1
-1
index.php
demo/protected/views/site/index.php
+12
-14
BootActiveForm.php
widgets/BootActiveForm.php
+2
-1
BootBaseMenu.php
widgets/BootBaseMenu.php
+0
-3
BootBreadcrumbs.php
widgets/BootBreadcrumbs.php
+3
-3
BootButton.php
widgets/BootButton.php
+51
-0
BootButtonColumn.php
widgets/BootButtonColumn.php
+11
-2
BootButtonGroup.php
widgets/BootButtonGroup.php
+31
-0
BootDetailView.php
widgets/BootDetailView.php
+1
-1
BootDropdown.php
widgets/BootDropdown.php
+4
-1
BootMenu.php
widgets/BootMenu.php
+4
-1
BootModal.php
widgets/BootModal.php
+1
-1
BootNavbar.php
widgets/BootNavbar.php
+1
-1
BootProgress.php
widgets/BootProgress.php
+1
-1
BootTabbable.php
widgets/BootTabbable.php
+1
-1
BootThumbnails.php
widgets/BootThumbnails.php
+1
-1
No files found.
components/Bootstrap.php
View file @
dad11791
...
...
@@ -38,6 +38,10 @@ class Bootstrap extends CApplicationComponent
*/
public
$responsiveCss
=
false
;
/**
* @var boolean whether to register jQuery and the Bootstrap JavaScript.
*/
public
$enableJS
=
true
;
/**
* @var array the plugin options (name=>options).
* @since 0.9.8
*/
...
...
@@ -60,8 +64,11 @@ class Bootstrap extends CApplicationComponent
if
(
$this
->
responsiveCss
)
$this
->
registerResponsiveCss
();
Yii
::
app
()
->
clientScript
->
registerCoreScript
(
'jquery'
);
$this
->
registerCorePlugins
();
if
(
$this
->
enableJS
)
{
Yii
::
app
()
->
clientScript
->
registerCoreScript
(
'jquery'
);
$this
->
registerCorePlugins
();
}
}
/**
...
...
demo/protected/views/layouts/main.php
View file @
dad11791
...
...
@@ -101,7 +101,7 @@
));
?>
<?php
if
(
!
empty
(
$this
->
breadcrumbs
))
:?>
<?
php
$this
->
widget
(
'bootstrap.widgets.Boot
Crumb
'
,
array
(
<?
php
$this
->
widget
(
'bootstrap.widgets.Boot
Breadcrumbs
'
,
array
(
'links'
=>
$this
->
breadcrumbs
,
));
?>
<?php
endif
?>
...
...
demo/protected/views/site/index.php
View file @
dad11791
...
...
@@ -42,11 +42,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</section>
<section
id=
"boot
Crumb
"
>
<section
id=
"boot
Breadcrumbs
"
>
<h2>
Breadcrumbs
</h2>
<?php
$this
->
widget
(
'bootstrap.widgets.Boot
Crumb
'
,
array
(
<?php
$this
->
widget
(
'bootstrap.widgets.Boot
Breadcrumbs
'
,
array
(
'links'
=>
array
(
'Library'
=>
'#'
,
'Data'
),
));
?>
...
...
@@ -54,7 +54,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?php
echo
$parser
->
safeTransform
(
"~~~
[php]
<?php
\$
this->widget('bootstrap.widgets.Boot
Crumb
', array(
<?php
\$
this->widget('bootstrap.widgets.Boot
Breadcrumbs
', array(
'links'=>array('Library'=>'#', 'Data'),
)); ?>
~~~"
);
?>
...
...
@@ -81,7 +81,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
array
(
'label'
=>
'Link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'url'
=>
'#'
,
'items'
=>
array
(
array
(
'label'
=>
'DROPDOWN HEADER'
,
'header'
=>
true
),
array
(
'label'
=>
'DROPDOWN HEADER'
),
array
(
'label'
=>
'Action'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Another action'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
...
...
@@ -97,6 +97,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
'items'
=>
array
(
array
(
'label'
=>
'Link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'url'
=>
'#'
,
'items'
=>
array
(
array
(
'label'
=>
'DROPDOWN HEADER'
),
array
(
'label'
=>
'Action'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Another action'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
...
...
@@ -124,7 +125,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
array('label'=>'Home', 'url'=>'#', 'active'=>true),
array('label'=>'Link', 'url'=>'#'),
array('label'=>'Dropdown', 'url'=>'#', 'items'=>array(
array('label'=>'DROPDOWN HEADER'
, 'itemOptions'=>array('class'=>'nav-header')
),
array('label'=>'DROPDOWN HEADER'),
array('label'=>'Action', 'url'=>'#'),
array('label'=>'Another action', 'url'=>'#'),
array('label'=>'Something else here', 'url'=>'#'),
...
...
@@ -140,6 +141,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
'items'=>array(
array('label'=>'Link', 'url'=>'#'),
array('label'=>'Dropdown', 'url'=>'#', 'items'=>array(
array('label'=>'DROPDOWN HEADER'),
array('label'=>'Action', 'url'=>'#'),
array('label'=>'Another action', 'url'=>'#'),
array('label'=>'Something else here', 'url'=>'#'),
...
...
@@ -470,11 +472,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</section>
<section
id=
"bootThumbs"
>
<section
id=
"bootThumb
nail
s"
>
<h2>
Thumbnails
</h2>
<?php
$this
->
widget
(
'bootstrap.widgets.BootThumbs'
,
array
(
<?php
$this
->
widget
(
'bootstrap.widgets.BootThumb
nail
s'
,
array
(
'dataProvider'
=>
$listDataProvider
,
'template'
=>
"
{
items}\n{pager
}
"
,
'itemView'
=>
'_thumb'
,
...
...
@@ -489,7 +491,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?php
echo
$parser
->
safeTransform
(
"~~~
[php]
<?php
\$
this->widget('bootstrap.widgets.BootThumbs', array(
<?php
\$
this->widget('bootstrap.widgets.BootThumb
nail
s', array(
'dataProvider'=>
\$
listDataProvider,
'template'=>
\"
{
items}\\n{pager
}
\"
,
'itemView'=>'_thumb',
...
...
@@ -701,10 +703,6 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?php
$this
->
endWidget
();
?>
<div
class=
"alert alert-block alert-warning"
>
</div>
<h3>
Horizontal
</h3>
<?php
/** @var BootActiveForm $form */
...
...
@@ -1367,13 +1365,13 @@ $('#buttonStateful').click(function() {
'scrollspy'
=>
array
(
'spy'
=>
'.subnav'
,
'offset'
=>
50
),
'items'
=>
array
(
array
(
'label'
=>
'Alert'
,
'url'
=>
'#bootAlert'
),
array
(
'label'
=>
'Breadcrumb'
,
'url'
=>
'#boot
Crumb
'
),
array
(
'label'
=>
'Breadcrumb'
,
'url'
=>
'#boot
Breadcrumbs
'
),
array
(
'label'
=>
'Navbar'
,
'url'
=>
'#bootNavbar'
),
array
(
'label'
=>
'Menu'
,
'url'
=>
'#bootMenu'
),
array
(
'label'
=>
'Tabbable'
,
'url'
=>
'#bootTabbable'
),
array
(
'label'
=>
'Detail view'
,
'url'
=>
'#bootDetailView'
),
array
(
'label'
=>
'Grid view'
,
'url'
=>
'#bootGridView'
),
array
(
'label'
=>
'Thumbnail'
,
'url'
=>
'#bootThumbs'
),
array
(
'label'
=>
'Thumbnail'
,
'url'
=>
'#bootThumb
nail
s'
),
array
(
'label'
=>
'Tooltip'
,
'url'
=>
'#bootTooltip'
),
array
(
'label'
=>
'Popover'
,
'url'
=>
'#bootPopover'
),
array
(
'label'
=>
'Modal'
,
'url'
=>
'#bootModal'
),
...
...
widgets/BootActiveForm.php
View file @
dad11791
...
...
@@ -14,12 +14,13 @@ Yii::import('bootstrap.widgets.input.BootInput');
*/
class
BootActiveForm
extends
CActiveForm
{
//
The different f
orm types.
//
F
orm types.
const
TYPE_VERTICAL
=
'vertical'
;
const
TYPE_INLINE
=
'inline'
;
const
TYPE_HORIZONTAL
=
'horizontal'
;
const
TYPE_SEARCH
=
'search'
;
// Input classes.
const
INPUT_HORIZONTAL
=
'bootstrap.widgets.input.BootInputHorizontal'
;
const
INPUT_INLINE
=
'bootstrap.widgets.input.BootInputInline'
;
const
INPUT_SEARCH
=
'bootstrap.widgets.input.BootInputSearch'
;
...
...
widgets/BootBaseMenu.php
View file @
dad11791
...
...
@@ -55,9 +55,6 @@ abstract class BootBaseMenu extends BootWidget
$item
[
'label'
]
=
'<i class="'
.
$item
[
'icon'
]
.
'"></i> '
.
$item
[
'label'
];
}
if
(
!
isset
(
$item
[
'header'
])
&&
!
isset
(
$item
[
'url'
]))
$item
[
'url'
]
=
'#'
;
if
(
isset
(
$item
[
'url'
]))
return
CHtml
::
link
(
$item
[
'label'
],
$item
[
'url'
],
$item
[
'linkOptions'
]);
else
...
...
widgets/Boot
Crumb
.php
→
widgets/Boot
Breadcrumbs
.php
View file @
dad11791
...
...
@@ -12,14 +12,14 @@ Yii::import('zii.widgets.CBreadcrumbs');
/**
* Bootstrap breadcrumb widget.
*/
class
Boot
Crumb
extends
CBreadcrumbs
class
Boot
Breadcrumbs
extends
CBreadcrumbs
{
/**
* @var array the HTML attributes for the breadcrumbs container tag.
*/
public
$htmlOptions
=
array
(
'class'
=>
'breadcrumb'
);
public
$htmlOptions
=
array
(
'class'
=>
'breadcrumb'
);
/**
* @var string the separator between links in the breadcrumbs
. Defaults to ' / '
.
* @var string the separator between links in the breadcrumbs
(defaults to ' / ')
.
*/
public
$separator
=
'/'
;
...
...
widgets/BootButton.php
View file @
dad11791
...
...
@@ -10,13 +10,18 @@
Yii
::
import
(
'bootstrap.widgets.BootWidget'
);
/**
* Bootstrap button widget.
*/
class
BootButton
extends
BootWidget
{
// Button methods.
const
METHOD_LINK
=
'link'
;
const
METHOD_BUTTON
=
'button'
;
const
METHOD_AJAXLINK
=
'ajaxLink'
;
const
METHOD_AJAXBUTTON
=
'ajaxButton'
;
// Button types.
const
TYPE_NORMAL
=
''
;
const
TYPE_PRIMARY
=
'primary'
;
const
TYPE_INFO
=
'info'
;
...
...
@@ -25,22 +30,65 @@ class BootButton extends BootWidget
const
TYPE_DANGER
=
'danger'
;
const
TYPE_INVERSE
=
'inverse'
;
// Button sizes.
const
SIZE_SMALL
=
'small'
;
const
SIZE_NORMAL
=
''
;
const
SIZE_LARGE
=
'large'
;
/**
* @var string the method to use for rendering the button.
* Valid values are 'link', 'button', 'ajaxLink' and 'ajaxButton'.
*/
public
$method
=
self
::
METHOD_LINK
;
/**
* @var string the button type.
* Valid values are '', 'primary', 'info', 'success', 'warning', 'danger' and 'inverse'.
*/
public
$type
=
self
::
TYPE_NORMAL
;
/**
* @var string the button size.
* Valid values are '', 'small' and 'large'.
*/
public
$size
=
self
::
SIZE_NORMAL
;
/**
* @var string the button icon, e.g. 'ok' or 'remove white'.
*/
public
$icon
;
/**
* @var string the button label.
*/
public
$label
;
/**
* @var string the button URL.
*/
public
$url
;
/**
* @var boolean indicates whether the button is active.
*/
public
$active
=
false
;
/**
* @var array the dropdown button items.
*/
public
$items
;
/**
* @var boolean indicates whether to enable toggle.
*/
public
$toggle
;
/**
* @var string the loading text.
*/
public
$loadingText
;
/**
* @var string the complete text.
*/
public
$completeText
;
/**
* @var boolean indicates whether to encode the label.
*/
public
$encodeLabel
=
true
;
/**
* @var array the button ajax options (used by 'ajaxLink' and 'ajaxButton').
*/
public
$ajaxOptions
=
array
();
/**
...
...
@@ -70,6 +118,9 @@ class BootButton extends BootWidget
if
(
$this
->
hasDropdown
())
{
if
(
!
isset
(
$this
->
url
))
$this
->
url
=
'#'
;
$class
[]
=
'dropdown-toggle'
;
$this
->
label
.=
' <span class="caret"></span>'
;
$this
->
htmlOptions
[
'data-toggle'
]
=
'dropdown'
;
...
...
widgets/BootButtonColumn.php
View file @
dad11791
...
...
@@ -5,19 +5,28 @@
* @copyright Copyright © Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.widgets
* @since 0.9.8
*/
Yii
::
import
(
'zii.widgets.grid.CButtonColumn'
);
/**
* Bootstrap button column widget.
* Used to set zbuttons to use Glyphicons instead of the defaults.
* @since 0.9.8
* Used to set buttons to use Glyphicons instead of the defaults images.
*/
class
BootButtonColumn
extends
CButtonColumn
{
/**
* @var string the view button icon (defaults to 'eye-open').
*/
public
$viewButtonIcon
=
'eye-open'
;
/**
* @var string the update button icon (defaults to 'pencil').
*/
public
$updateButtonIcon
=
'pencil'
;
/**
* @var string the delete button icon (defaults to 'trash').
*/
public
$deleteButtonIcon
=
'trash'
;
/**
...
...
widgets/BootButtonGroup.php
View file @
dad11791
...
...
@@ -11,18 +11,46 @@
Yii
::
import
(
'bootstrap.widgets.BootButton'
);
Yii
::
import
(
'bootstrap.widgets.BootWidget'
);
/**
* Bootstrap button group widget.
*/
class
BootButtonGroup
extends
BootWidget
{
// Toggle options.
const
TOGGLE_CHECKBOX
=
'checkbox'
;
const
TOGGLE_RADIO
=
'radio'
;
/**
* @var string the button method.
* @see BootButton::method
*/
public
$method
=
BootButton
::
METHOD_LINK
;
/**
* @var string the button type.
* @see BootButton::type
*/
public
$type
=
BootButton
::
TYPE_NORMAL
;
/**
* @var string the button size.
* @see BootButton::size
*/
public
$size
=
BootButton
::
SIZE_NORMAL
;
/**
* @var boolean indicates whether to encode the button labels.
*/
public
$encodeLabel
=
true
;
/**
* @var array the button configuration.
*/
public
$buttons
=
array
();
/**
* @var boolean indicates whether to enable button toggling.
*/
public
$toggle
;
/**
* Initializes the widget.
*/
public
function
init
()
{
$cssClass
=
'btn-group'
;
...
...
@@ -40,6 +68,9 @@ class BootButtonGroup extends BootWidget
}
}
/**
* Runs the widget.
*/
public
function
run
()
{
echo
CHtml
::
openTag
(
'div'
,
$this
->
htmlOptions
);
...
...
widgets/BootDetailView.php
View file @
dad11791
...
...
@@ -18,7 +18,7 @@ class BootDetailView extends CDetailView
/**
* @var string the template used to render a single attribute. Defaults to a table row.
*/
public
$itemTemplate
=
"<tr class=
\"
{
class
}
\"
><th style=
\"
width: 160px
\"
>
{
label}</th><td>{value
}
</td></tr>
\n
"
;
public
$itemTemplate
=
"<tr class=
\"
{
class
}
\"
><th style=
\"
width: 160px
\"
>
{
label}</th><td>{value
}
</td></tr>
\n
"
;
/**
* @var array the CSS class names for the items displaying attribute values.
*/
...
...
widgets/BootDropdown.php
View file @
dad11791
...
...
@@ -10,6 +10,9 @@
Yii
::
import
(
'bootstrap.widgets.BootBaseMenu'
);
/**
* Bootstrap dropdown menu widget.
*/
class
BootDropdown
extends
BootBaseMenu
{
/**
...
...
@@ -45,7 +48,7 @@ class BootDropdown extends BootBaseMenu
$item
[
'itemOptions'
]
=
array
();
$class
=
array
();
if
(
isset
(
$item
[
'header
'
]))
if
(
!
isset
(
$item
[
'url
'
]))
$class
[]
=
'nav-header'
;
if
(
$item
[
'active'
])
...
...
widgets/BootMenu.php
View file @
dad11791
...
...
@@ -16,7 +16,7 @@ Yii::import('bootstrap.widgets.BootBaseMenu');
*/
class
BootMenu
extends
BootBaseMenu
{
//
The different m
enu types.
//
M
enu types.
const
TYPE_UNSTYLED
=
''
;
const
TYPE_TABS
=
'tabs'
;
const
TYPE_PILLS
=
'pills'
;
...
...
@@ -151,6 +151,9 @@ class BootMenu extends BootBaseMenu
$item
[
'label'
]
.=
' <span class="caret"></span>'
;
}
if
(
!
isset
(
$item
[
'url'
]))
$item
[
'url'
]
=
'#'
;
return
parent
::
renderItem
(
$item
);
}
...
...
widgets/BootModal.php
View file @
dad11791
...
...
@@ -5,13 +5,13 @@
* @copyright Copyright © Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.widgets
* @since 0.9.3
*/
Yii
::
import
(
'bootstrap.widgets.BootWidget'
);
/**
* Bootstrap modal widget.
* @since 0.9.3
*/
class
BootModal
extends
BootWidget
{
...
...
widgets/BootNavbar.php
View file @
dad11791
...
...
@@ -5,13 +5,13 @@
* @copyright Copyright © Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.widgets
* @since 0.9.7
*/
Yii
::
import
(
'bootstrap.widgets.BootWidget'
);
/**
* Bootstrap navigation bar widget.
* @since 0.9.7
*/
class
BootNavbar
extends
BootWidget
{
...
...
widgets/BootProgress.php
View file @
dad11791
...
...
@@ -15,7 +15,7 @@ Yii::import('bootstrap.widgets.BootWidget');
*/
class
BootProgress
extends
BootWidget
{
//
The different p
rogress bar types.
//
P
rogress bar types.
const
TYPE_DEFAULT
=
''
;
const
TYPE_INFO
=
'info'
;
const
TYPE_SUCCESS
=
'success'
;
...
...
widgets/BootTabbable.php
View file @
dad11791
...
...
@@ -17,7 +17,7 @@ Yii::import('bootstrap.widgets.BootWidget');
*/
class
BootTabbable
extends
BootWidget
{
// T
he valid
placements.
// T
ab
placements.
const
PLACEMENT_ABOVE
=
'above'
;
const
PLACEMENT_BELOW
=
'below'
;
const
PLACEMENT_LEFT
=
'left'
;
...
...
widgets/BootThumbs.php
→
widgets/BootThumb
nail
s.php
View file @
dad11791
...
...
@@ -12,7 +12,7 @@ Yii::import('bootstrap.widgets.BootListView');
/**
* Bootstrap thumbnails widget.
*/
class
BootThumbs
extends
BootListView
class
BootThumb
nail
s
extends
BootListView
{
/**
* Renders the data items for the view.
...
...
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