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
5322f2a6
Commit
5322f2a6
authored
Feb 07, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the test page.
parent
2de9d8b6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
185 additions
and
139 deletions
+185
-139
BootGridView.php
bootstrap/widgets/BootGridView.php
+6
-2
styles.less
demo/less/styles.less
+7
-2
SiteController.php
demo/protected/controllers/SiteController.php
+35
-86
_thumb.php
demo/protected/views/site/_thumb.php
+6
-0
index.php
demo/protected/views/site/index.php
+131
-49
No files found.
bootstrap/widgets/BootGridView.php
View file @
5322f2a6
...
...
@@ -11,8 +11,12 @@ Yii::import('zii.widgets.grid.CGridView');
class
BootGridView
extends
CGridView
{
/**
* @var string the CSS class name for the container table.
* Defaults to 'table'.
* @var boolean whether to display the table even when there is no data. Defaults to false.
*/
public
$showTableOnEmpty
=
false
;
/**
* @var string the CSS class name for the container table. Defaults to 'table'.
*/
public
$itemsCssClass
=
'table'
;
/**
...
...
demo/less/styles.less
View file @
5322f2a6
...
...
@@ -11,7 +11,7 @@ body {
padding-bottom: 40px;
}
h1, h2, h3 {
h1, h2, h3
, h4, h5, h6
{
margin-bottom: 0.6em;
}
...
...
@@ -29,5 +29,9 @@ span.required {
}
#bootNavbar .navbar-inner > .container {
width: 660px;
width: 740px;
}
#bootThumbs .list-view {
padding-top: 30px;
}
\ No newline at end of file
demo/protected/controllers/SiteController.php
View file @
5322f2a6
...
...
@@ -3,33 +3,46 @@
class
SiteController
extends
Controller
{
/**
* Declares class-based actions.
*/
public
function
actions
()
{
return
array
(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'
=>
array
(
'class'
=>
'CCaptchaAction'
,
'backColor'
=>
0xFFFFFF
,
),
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page'
=>
array
(
'class'
=>
'CViewAction'
,
),
);
}
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public
function
actionIndex
()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$this
->
render
(
'index'
);
$gridDataProvider
=
new
CArrayDataProvider
(
array
(
array
(
'id'
=>
1
,
'firstName'
=>
'Mark'
,
'lastName'
=>
'Otto'
,
'language'
=>
'CSS'
),
array
(
'id'
=>
2
,
'firstName'
=>
'Jacob'
,
'lastName'
=>
'Thornton'
,
'language'
=>
'JavaScript'
),
array
(
'id'
=>
3
,
'firstName'
=>
'Stu'
,
'lastName'
=>
'Dent'
,
'language'
=>
'HTML'
),
));
$gridColumns
=
array
(
array
(
'name'
=>
'id'
,
'header'
=>
'#'
),
array
(
'name'
=>
'firstName'
,
'header'
=>
'First name'
),
array
(
'name'
=>
'lastName'
,
'header'
=>
'Last name'
),
array
(
'name'
=>
'language'
,
'header'
=>
'Language'
),
array
(
'class'
=>
'BootButtonColumn'
,
'viewButtonUrl'
=>
null
,
'viewButtonOptions'
=>
array
(
'rel'
=>
'tooltip'
),
'updateButtonUrl'
=>
null
,
'updateButtonOptions'
=>
array
(
'rel'
=>
'tooltip'
),
'deleteButtonUrl'
=>
null
,
'deleteButtonOptions'
=>
array
(
'rel'
=>
'tooltip'
),
)
);
$rawData
=
array
();
for
(
$i
=
0
;
$i
<
200
;
$i
++
)
$rawData
[]
=
array
(
'id'
=>
$i
+
1
);
$listDataProvider
=
new
CArrayDataProvider
(
$rawData
,
array
(
'pagination'
=>
array
(
'pageSize'
=>
10
),
));
$this
->
render
(
'index'
,
array
(
'gridDataProvider'
=>
$gridDataProvider
,
'gridColumns'
=>
$gridColumns
,
'listDataProvider'
=>
$listDataProvider
,
));
}
/**
...
...
@@ -45,67 +58,4 @@ class SiteController extends Controller
$this
->
render
(
'error'
,
$error
);
}
}
/**
* Displays the contact page
*/
public
function
actionContact
()
{
$model
=
new
ContactForm
;
// if it is ajax validation request
if
(
isset
(
$_POST
[
'ajax'
])
&&
$_POST
[
'ajax'
]
===
'contact-form'
)
{
echo
CActiveForm
::
validate
(
$model
);
Yii
::
app
()
->
end
();
}
if
(
isset
(
$_POST
[
'ContactForm'
]))
{
$model
->
attributes
=
$_POST
[
'ContactForm'
];
if
(
$model
->
validate
())
{
$headers
=
"From:
{
$model
->
email
}
\r\n
Reply-To:
{
$model
->
email
}
"
;
mail
(
Yii
::
app
()
->
params
[
'adminEmail'
],
$model
->
subject
,
$model
->
body
,
$headers
);
Yii
::
app
()
->
user
->
setFlash
(
'contact'
,
'Thank you for contacting us. We will respond to you as soon as possible.'
);
$this
->
refresh
();
}
}
$this
->
render
(
'contact'
,
array
(
'model'
=>
$model
));
}
/**
* Displays the login page
*/
public
function
actionLogin
()
{
$model
=
new
LoginForm
;
// if it is ajax validation request
if
(
isset
(
$_POST
[
'ajax'
])
&&
$_POST
[
'ajax'
]
===
'login-form'
)
{
echo
CActiveForm
::
validate
(
$model
);
Yii
::
app
()
->
end
();
}
// collect user input data
if
(
isset
(
$_POST
[
'LoginForm'
]))
{
$model
->
attributes
=
$_POST
[
'LoginForm'
];
// validate user input and redirect to the previous page if valid
if
(
$model
->
validate
()
&&
$model
->
login
())
$this
->
redirect
(
Yii
::
app
()
->
user
->
returnUrl
);
}
// display the login form
$this
->
render
(
'login'
,
array
(
'model'
=>
$model
));
}
/**
* Logs out the current user and redirect to homepage.
*/
public
function
actionLogout
()
{
Yii
::
app
()
->
user
->
logout
();
$this
->
redirect
(
Yii
::
app
()
->
homeUrl
);
}
}
\ No newline at end of file
demo/protected/views/site/_thumb.php
0 → 100644
View file @
5322f2a6
<li
class=
"span2"
>
<a
href=
"#"
class=
"thumbnail"
>
<img
src=
"http://placehold.it/160x120"
alt=
""
>
</a>
</li>
\ No newline at end of file
demo/protected/views/site/index.php
View file @
5322f2a6
...
...
@@ -2,7 +2,7 @@
<div
class=
"row"
>
<div
class=
"span
9
"
>
<div
class=
"span
10
"
>
<div
id=
"bootActiveForm"
>
...
...
@@ -29,12 +29,12 @@
<h3>
BootAlert
</h3>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'success'
,
'
Success!
'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'
warning'
,
'This is a warning
.'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'
info'
,
'Attention!
'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'error'
,
'
This is an error
.'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'success'
,
'
<strong>Well done!</strong> You successfully read this important alert message.
'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'
info'
,
'<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important
.'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'
warning'
,
'<strong>Warning!</strong> Best check yo self, you\'re not looking too good.
'
);
?>
<?php
Yii
::
app
()
->
user
->
setFlash
(
'error'
,
'
<strong>Oh snap!</strong> Change a few things up and try submitting again
.'
);
?>
<?php
$this
->
widget
(
'BootAlert'
,
array
(
<?php
$this
->
widget
(
'BootAlert'
,
array
(
'options'
=>
array
(
'displayTime'
=>
0
),
));
?>
...
...
@@ -103,42 +103,97 @@
<h3>
BootMenu
</h3>
<h
5>
Tabs
</h5
>
<h
4>
Tabs
</h4
>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'tabs'
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
<div
class=
"row"
>
<h5>
Pills (Stacked)
</h5
>
<div
class=
"span5"
>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'pills'
,
'stacked'
=>
true
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'tabs'
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
</div>
<div
class=
"span5"
>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'tabs'
,
'stacked'
=>
true
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
</div>
</div>
<h4>
Pills
</h4>
<div
class=
"row"
>
<div
class=
"span5"
>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'pills'
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
</div>
<div
class=
"span5"
>
<?php
$this
->
widget
(
'BootMenu'
,
array
(
'type'
=>
'pills'
,
'stacked'
=>
true
,
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
'#'
,
'active'
=>
true
),
array
(
'label'
=>
'Profile'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Dropdown'
,
'items'
=>
array
(
array
(
'label'
=>
'Secondary link'
,
'url'
=>
'#'
),
array
(
'label'
=>
'Something else here'
,
'url'
=>
'#'
),
'---'
,
array
(
'label'
=>
'Another link'
,
'url'
=>
'#'
),
)),
array
(
'label'
=>
'Messages'
,
'url'
=>
'#'
),
),
));
?>
</div>
</div>
<h
5>
List
</h5
>
<h
4>
List
</h4
>
<div
class=
"well"
style=
"padding: 8px 0;"
>
...
...
@@ -176,19 +231,43 @@
<div
id=
"bootGridView"
>
<h3>
BootGridView
</h3>
<p>
@todo
</p>
</div>
<hr
/
>
<h4>
Default
</h4
>
<div
id=
"bootListView"
>
<?php
$this
->
widget
(
'BootGridView'
,
array
(
'dataProvider'
=>
$gridDataProvider
,
'template'
=>
"
{
items
}
"
,
'itemsCssClass'
=>
'table'
,
'columns'
=>
$gridColumns
,
));
?>
<h
3>
BootListView
</h3
>
<h
4>
Striped
</h4
>
<p>
@todo
</p>
<?php
$this
->
widget
(
'BootGridView'
,
array
(
'dataProvider'
=>
$gridDataProvider
,
'template'
=>
"
{
items
}
"
,
'itemsCssClass'
=>
'table table-striped'
,
'columns'
=>
$gridColumns
,
));
?>
<h4>
Condensed
</h4>
<?php
$this
->
widget
(
'BootGridView'
,
array
(
'dataProvider'
=>
$gridDataProvider
,
'template'
=>
"
{
items
}
"
,
'itemsCssClass'
=>
'table table-condensed'
,
'columns'
=>
$gridColumns
,
));
?>
<h4>
Striped and condensed
</h4>
<?php
$this
->
widget
(
'BootGridView'
,
array
(
'dataProvider'
=>
$gridDataProvider
,
'template'
=>
"
{
items
}
"
,
'itemsCssClass'
=>
'table table-striped table-condensed'
,
'columns'
=>
$gridColumns
,
));
?>
</div>
<hr
/>
...
...
@@ -197,7 +276,11 @@
<h3>
BootThumbs
</h3>
<p>
@todo
</p>
<?php
$this
->
widget
(
'BootThumbs'
,
array
(
'dataProvider'
=>
$listDataProvider
,
'template'
=>
"
{
items}\n{pager
}
"
,
'itemView'
=>
'_thumb'
,
));
?>
</div>
...
...
@@ -277,7 +360,7 @@
</div>
<div
class=
"span
3
"
>
<div
class=
"span
2
"
>
<div
class=
"well"
style=
"padding: 8px 0;"
>
...
...
@@ -293,7 +376,6 @@
array
(
'label'
=>
'BootTabbed'
,
'url'
=>
'#bootTabbed'
),
array
(
'label'
=>
'BootDetailView'
,
'url'
=>
'#bootDetailView'
),
array
(
'label'
=>
'BootGridView'
,
'url'
=>
'#bootGridView'
),
array
(
'label'
=>
'BootListView'
,
'url'
=>
'#bootListView'
),
array
(
'label'
=>
'BootThumbs'
,
'url'
=>
'#bootThumbs'
),
array
(
'label'
=>
'BootTooltip'
,
'url'
=>
'#bootTooltip'
),
array
(
'label'
=>
'BootPopover'
,
'url'
=>
'#bootPopover'
),
...
...
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