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
47dceeb9
Commit
47dceeb9
authored
Mar 21, 2012
by
Crisu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added styles for grid view sorting and filters
parent
218da578
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
4 deletions
+100
-4
yii-bootstrap.css
assets/css/yii-bootstrap.css
+10
-3
mixins.less
lib/bootstrap/less/mixins.less
+1
-1
BootDataColumn.php
widgets/BootDataColumn.php
+52
-0
BootGridView.php
widgets/BootGridView.php
+37
-0
No files found.
assets/css/yii-bootstrap.css
View file @
47dceeb9
...
...
@@ -24,14 +24,20 @@ span.required {
}
.grid-view
table
.items
th
a
.caret
{
display
:
none
;
position
:
absolute
;
right
:
5px
;
top
:
7px
;
}
.grid-view
table
.items
th
a
.asc
.caret
{
display
:
block
;
}
.grid-view
table
.items
th
a
.desc
.caret
{
border-bottom
:
4px
solid
#000
;
border-top
:
none
;
display
:
block
;
}
.grid-view
table
.items
tr
.selected
td
{
...
...
@@ -60,13 +66,14 @@ span.required {
font-style
:
italic
;
}
.grid-view
.filters
.filter-container
{
padding
:
0
10px
0
0
;
}
.grid-view
.filters
input
,
.grid-view
.filters
select
{
border
:
none
;
margin-bottom
:
0
;
padding
:
0
;
width
:
100%
;
box-shadow
:
none
;
-o-box-shadow
:
none
;
-moz-box-shadow
:
none
;
-ms-box-shadow
:
none
;
-webkit-box-shadow
:
none
;
}
/*
...
...
lib/bootstrap/less/mixins.less
View file @
47dceeb9
...
...
@@ -393,7 +393,7 @@
}
// Reset filters for IE
.reset-filter() {
filter:
progid:DXImageTransform.Microsoft.gradient(enabled = false
);
filter:
e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")
);
}
...
...
widgets/BootDataColumn.php
0 → 100644
View file @
47dceeb9
<?php
/**
* BootDataColumn class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright © Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.widgets
*/
Yii
::
import
(
'zii.widgets.grid.CDataColumn'
);
/**
* Bootstrap grid data column
*/
class
BootDataColumn
extends
CDataColumn
{
/**
* Renders the header cell content.
* This method will render a link that can trigger the sorting if the column is sortable.
*/
protected
function
renderHeaderCellContent
()
{
if
(
$this
->
grid
->
enableSorting
&&
$this
->
sortable
&&
$this
->
name
!==
null
)
{
$label
=
isset
(
$this
->
header
)
?
$this
->
header
:
$this
->
grid
->
dataProvider
->
getSort
()
->
resolveLabel
(
$this
->
name
);
$label
.=
'<span class="caret"></span>'
;
echo
$this
->
grid
->
dataProvider
->
getSort
()
->
link
(
$this
->
name
,
$label
);
}
else
{
if
(
$this
->
name
!==
null
&&
$this
->
header
===
null
)
{
if
(
$this
->
grid
->
dataProvider
instanceof
CActiveDataProvider
)
echo
CHtml
::
encode
(
$this
->
grid
->
dataProvider
->
model
->
getAttributeLabel
(
$this
->
name
));
else
echo
CHtml
::
encode
(
$this
->
name
);
}
else
parent
::
renderHeaderCellContent
();
}
}
/**
* Renders the filter cell.
*/
public
function
renderFilterCell
()
{
echo
'<td><div class="filter-container">'
;
$this
->
renderFilterCellContent
();
echo
'</div></td>'
;
}
}
widgets/BootGridView.php
View file @
47dceeb9
...
...
@@ -8,6 +8,7 @@
*/
Yii
::
import
(
'zii.widgets.grid.CGridView'
);
Yii
::
import
(
'bootstrap.widgets.BootDataColumn'
);
/**
* Bootstrap grid view widget.
...
...
@@ -67,4 +68,40 @@ class BootGridView extends CGridView
$this
->
itemsCssClass
.=
' '
.
implode
(
' '
,
$class
);
}
/**
* Creates column objects and initializes them.
*/
protected
function
initColumns
()
{
foreach
(
$this
->
columns
as
$i
=>
$column
)
{
if
(
is_array
(
$column
)
&&
!
isset
(
$column
[
'class'
]))
$this
->
columns
[
$i
][
'class'
]
=
'bootstrap.widgets.BootDataColumn'
;
}
parent
::
initColumns
();
}
/**
* Creates a column based on a shortcut column specification string.
* @param mixed $text the column specification string
* @return \BootDataColumn|\CDataColumn the column instance
* @throws CException if the column format is incorrect
*/
protected
function
createDataColumn
(
$text
)
{
if
(
!
preg_match
(
'/^([\w\.]+)(:(\w*))?(:(.*))?$/'
,
$text
,
$matches
))
throw
new
CException
(
Yii
::
t
(
'zii'
,
'The column must be specified in the format of "Name:Type:Label", where "Type" and "Label" are optional.'
));
$column
=
new
BootDataColumn
(
$this
);
$column
->
name
=
$matches
[
1
];
if
(
isset
(
$matches
[
3
])
&&
$matches
[
3
]
!==
''
)
$column
->
type
=
$matches
[
3
];
if
(
isset
(
$matches
[
5
]))
$column
->
header
=
$matches
[
5
];
return
$column
;
}
}
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