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
f0d6adc5
Commit
f0d6adc5
authored
Apr 05, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed BootButton::fn to buttonType and updated the demo
parent
1a464dbc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
35 deletions
+56
-35
Bootstrap.php
components/Bootstrap.php
+2
-2
styles.css
demo/css/styles.css
+2
-1
styles.less
demo/less/styles.less
+3
-1
SiteController.php
demo/protected/controllers/SiteController.php
+13
-2
index.php
demo/protected/views/site/index.php
+0
-0
BootButton.php
widgets/BootButton.php
+23
-21
BootButtonGroup.php
widgets/BootButtonGroup.php
+4
-4
BootModal.php
widgets/BootModal.php
+9
-4
No files found.
components/Bootstrap.php
View file @
f0d6adc5
...
...
@@ -4,7 +4,7 @@
* @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright © Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version
1.0.0
* @version
0.9.11
*/
/**
...
...
@@ -99,7 +99,7 @@ class Bootstrap extends CApplicationComponent
/**
* Registers the Yii-specific CSS missing from Bootstrap.
* @since
1.0.0
* @since
0.9.11
*/
public
function
registerYiiCss
()
{
...
...
demo/css/styles.css
View file @
f0d6adc5
...
...
@@ -7,6 +7,7 @@
.input-block-level
{
display
:
block
;
width
:
100%
;
min-height
:
28px
;
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
-ms-box-sizing
:
border-box
;
box-sizing
:
border-box
;}
.php-hl-default
{
color
:
Black
;}
.php-hl-code
{
color
:
Gray
;}
.php-hl-brackets
{
color
:
Olive
;}
...
...
@@ -150,7 +151,7 @@ section{padding-top:40px;}section a.top{display:block;text-align:right;}
#bootCarousel
.carousel
{
width
:
770px
;}
#bootCarousel
.carousel
.carousel-caption
p
{
margin-bottom
:
9px
;}
#bootTypeahead
input
{
margin-bottom
:
0
;}
.
hl-code
{
margin-bottom
:
20px
;}
.hl-code
pre
{
background
:
#FCFCFC
;
border-color
:
#EEE
transparent
#EEE
;
font-family
:
"Menlo"
,
"Consolas"
,
"Courier New"
,
Courier
,
mono
;
-webkit-border-radius
:
0
;
-moz-border-radius
:
0
;
border-radius
:
0
;}
.
php-hl-main
,
.html-hl-main
,
.javascript-hl-main
{
margin-bottom
:
20px
;}
.php-hl-main
pre
,
.html-hl-main
pre
,
.javascript-hl-main
pre
{
background
:
#FCFCFC
;
border-color
:
#EEE
transparent
#EEE
;
font-family
:
"Menlo"
,
"Consolas"
,
"Courier New"
,
Courier
,
mono
;
-webkit-border-radius
:
0
;
-moz-border-radius
:
0
;
border-radius
:
0
;}
.maintenance
.hero-unit
{
text-align
:
center
;}
.maintenance
.hero-unit
p
{
text-align
:
inherit
;}
...
...
demo/less/styles.less
View file @
f0d6adc5
...
...
@@ -138,7 +138,9 @@ section {
margin-bottom: 0;
}
.hl-code {
.php-hl-main,
.html-hl-main,
.javascript-hl-main {
margin-bottom: 20px;
pre {
...
...
demo/protected/controllers/SiteController.php
View file @
f0d6adc5
...
...
@@ -45,7 +45,7 @@ class SiteController extends Controller
);
$tabbable
=
array
(
array
(
'label'
=>
'Section 1'
,
'content'
=>
'<p>I\'m in Section 1.</p>'
),
array
(
'label'
=>
'Section 1'
,
'content'
=>
'<p>I\'m in Section 1.</p>'
,
'active'
=>
true
),
array
(
'label'
=>
'Section 2'
,
'content'
=>
'<p>Howdy, I\'m in Section 2.</p>'
),
array
(
'label'
=>
'Section 3'
,
'content'
=>
'<p>What up girl, this is Section 3.</p>'
),
);
...
...
@@ -93,6 +93,15 @@ class SiteController extends Controller
'pagination'
=>
array
(
'pageSize'
=>
8
),
));
$phpLighter
=
new
CTextHighlighter
();
$phpLighter
->
language
=
'PHP'
;
$jsLighter
=
new
CTextHighlighter
();
$jsLighter
->
language
=
'JAVASCRIPT'
;
$htmlLighter
=
new
CTextHighlighter
();
$htmlLighter
->
language
=
'HTML'
;
$this
->
render
(
'index'
,
array
(
'model'
=>
$model
,
'person'
=>
new
Person
(),
...
...
@@ -101,7 +110,9 @@ class SiteController extends Controller
'gridDataProvider'
=>
$gridDataProvider
,
'gridColumns'
=>
$gridColumns
,
'listDataProvider'
=>
$listDataProvider
,
'parser'
=>
new
CMarkdownParser
(),
'phpLighter'
=>
$phpLighter
,
'jsLighter'
=>
$jsLighter
,
'htmlLighter'
=>
$htmlLighter
,
));
}
...
...
demo/protected/views/site/index.php
View file @
f0d6adc5
This diff is collapsed.
Click to expand it.
widgets/BootButton.php
View file @
f0d6adc5
...
...
@@ -15,15 +15,15 @@ Yii::import('bootstrap.widgets.BootWidget');
*/
class
BootButton
extends
BootWidget
{
// Button callback
function
s.
const
F
N_LINK
=
'link'
;
const
F
N_BUTTON
=
'button'
;
const
F
N_SUBMIT
=
'submit'
;
const
F
N_SUBMITLINK
=
'submitLink'
;
const
F
N_RESET
=
'reset'
;
const
F
N_AJAXLINK
=
'ajaxLink'
;
const
F
N_AJAXBUTTON
=
'ajaxButton'
;
const
F
N_AJAXSUBMIT
=
'ajaxSubmit'
;
// Button callback
type
s.
const
BUTTO
N_LINK
=
'link'
;
const
BUTTO
N_BUTTON
=
'button'
;
const
BUTTO
N_SUBMIT
=
'submit'
;
const
BUTTO
N_SUBMITLINK
=
'submitLink'
;
const
BUTTO
N_RESET
=
'reset'
;
const
BUTTO
N_AJAXLINK
=
'ajaxLink'
;
const
BUTTO
N_AJAXBUTTON
=
'ajaxButton'
;
const
BUTTO
N_AJAXSUBMIT
=
'ajaxSubmit'
;
// Button types.
const
TYPE_NORMAL
=
''
;
...
...
@@ -41,10 +41,10 @@ class BootButton extends BootWidget
const
SIZE_LARGE
=
'large'
;
/**
* @var string the
callback function for rendering the button
.
* @var string the
button callback types
.
* Valid values are 'link', 'button', 'submit', 'submitLink', 'reset', 'ajaxLink', 'ajaxButton' and 'ajaxSubmit'.
*/
public
$
fn
=
self
::
F
N_LINK
;
public
$
buttonType
=
self
::
BUTTO
N_LINK
;
/**
* @var string the button type.
* Valid values are '', 'primary', 'info', 'success', 'warning', 'danger' and 'inverse'.
...
...
@@ -97,7 +97,7 @@ class BootButton extends BootWidget
public
$ajaxOptions
=
array
();
/**
* @var array the HTML options for the dropdown menu.
* @since
1.0.0
* @since
0.9.11
*/
public
$dropdownOptions
=
array
();
...
...
@@ -181,11 +181,13 @@ class BootButton extends BootWidget
echo
$this
->
createButton
();
if
(
$this
->
hasDropdown
())
{
$this
->
controller
->
widget
(
'bootstrap.widgets.BootDropdown'
,
array
(
'encodeLabel'
=>
$this
->
encodeLabel
,
'items'
=>
$this
->
items
,
'htmlOptions'
=>
$this
->
dropdownOptions
,
));
}
}
/**
...
...
@@ -194,31 +196,31 @@ class BootButton extends BootWidget
*/
protected
function
createButton
()
{
switch
(
$this
->
fn
)
switch
(
$this
->
buttonType
)
{
case
self
::
F
N_BUTTON
:
case
self
::
BUTTO
N_BUTTON
:
return
CHtml
::
htmlButton
(
$this
->
label
,
$this
->
htmlOptions
);
case
self
::
F
N_SUBMIT
:
case
self
::
BUTTO
N_SUBMIT
:
$this
->
htmlOptions
[
'type'
]
=
'submit'
;
return
CHtml
::
htmlButton
(
$this
->
label
,
$this
->
htmlOptions
);
case
self
::
F
N_RESET
:
case
self
::
BUTTO
N_RESET
:
$this
->
htmlOptions
[
'type'
]
=
'reset'
;
return
CHtml
::
htmlButton
(
$this
->
label
,
$this
->
htmlOptions
);
case
self
::
F
N_SUBMITLINK
:
case
self
::
BUTTO
N_SUBMITLINK
:
return
CHtml
::
linkButton
(
$this
->
label
,
$this
->
htmlOptions
);
case
self
::
F
N_AJAXLINK
:
case
self
::
BUTTO
N_AJAXLINK
:
return
CHtml
::
ajaxLink
(
$this
->
label
,
$this
->
url
,
$this
->
ajaxOptions
,
$this
->
htmlOptions
);
case
self
::
F
N_AJAXBUTTON
:
case
self
::
BUTTO
N_AJAXBUTTON
:
$this
->
ajaxOptions
[
'url'
]
=
$this
->
url
;
$this
->
htmlOptions
[
'ajax'
]
=
$this
->
ajaxOptions
;
return
CHtml
::
htmlButton
(
$this
->
label
,
$this
->
htmlOptions
);
case
self
::
F
N_AJAXSUBMIT
:
case
self
::
BUTTO
N_AJAXSUBMIT
:
$this
->
ajaxOptions
[
'type'
]
=
'POST'
;
$this
->
ajaxOptions
[
'url'
]
=
$this
->
url
;
$this
->
htmlOptions
[
'type'
]
=
'submit'
;
...
...
@@ -226,7 +228,7 @@ class BootButton extends BootWidget
return
CHtml
::
htmlButton
(
$this
->
label
,
$this
->
htmlOptions
);
default
:
case
self
::
F
N_LINK
:
case
self
::
BUTTO
N_LINK
:
return
CHtml
::
link
(
$this
->
label
,
$this
->
url
,
$this
->
htmlOptions
);
}
}
...
...
widgets/BootButtonGroup.php
View file @
f0d6adc5
...
...
@@ -21,10 +21,10 @@ class BootButtonGroup extends BootWidget
const
TOGGLE_RADIO
=
'radio'
;
/**
* @var string the button
function
.
* @see BootButton::
fn
* @var string the button
callback type
.
* @see BootButton::
buttonType
*/
public
$
fn
=
BootButton
::
F
N_LINK
;
public
$
buttonType
=
BootButton
::
BUTTO
N_LINK
;
/**
* @var string the button type.
* @see BootButton::type
...
...
@@ -78,7 +78,7 @@ class BootButtonGroup extends BootWidget
foreach
(
$this
->
buttons
as
$button
)
{
$this
->
controller
->
widget
(
'bootstrap.widgets.BootButton'
,
array
(
'
fn'
=>
isset
(
$button
[
'fn'
])
?
$button
[
'fn'
]
:
$this
->
fn
,
'
buttonType'
=>
isset
(
$button
[
'buttonType'
])
?
$button
[
'buttonType'
]
:
$this
->
buttonType
,
'type'
=>
isset
(
$button
[
'type'
])
?
$button
[
'type'
]
:
$this
->
type
,
'size'
=>
$this
->
size
,
'icon'
=>
isset
(
$button
[
'icon'
])
?
$button
[
'icon'
]
:
null
,
...
...
widgets/BootModal.php
View file @
f0d6adc5
...
...
@@ -27,13 +27,18 @@ class BootModal extends BootWidget
if
(
!
isset
(
$this
->
htmlOptions
[
'id'
]))
$this
->
htmlOptions
[
'id'
]
=
$this
->
getId
();
$class
=
array
(
'modal'
);
if
(
Yii
::
app
()
->
bootstrap
->
isPluginRegistered
(
Bootstrap
::
PLUGIN_TRANSITION
))
$class
[]
=
'fade'
;
$cssClass
=
implode
(
' '
,
$class
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
'
modal'
;
$this
->
htmlOptions
[
'class'
]
.=
'
'
.
$cssClass
;
else
$this
->
htmlOptions
[
'class'
]
=
'modal'
;
$this
->
htmlOptions
[
'class'
]
=
$cssClass
;
if
(
Yii
::
app
()
->
bootstrap
->
isPluginRegistered
(
Bootstrap
::
PLUGIN_TRANSITION
))
$this
->
htmlOptions
[
'class'
]
.=
' fade'
;
echo
CHtml
::
openTag
(
'div'
,
$this
->
htmlOptions
)
.
PHP_EOL
;
}
...
...
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