mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #306 from silverstripe-big-o/report-fixes
API-CHANGE: new GridFieldFooter component
This commit is contained in:
commit
977e9f3576
@ -76,6 +76,7 @@
|
||||
.cms table.ss-gridfield-table tr th span.non-sortable { padding: 1em 1em; display: block; }
|
||||
.cms table.ss-gridfield-table tr td { border-right: 1px solid rgba(0, 0, 0, 0.1); padding: 6.4px 12px; color: #666666; }
|
||||
.cms table.ss-gridfield-table tr td.bottom-all { -moz-border-radius-bottomleft: 7px; -webkit-border-bottom-left-radius: 7px; -o-border-bottom-left-radius: 7px; -ms-border-bottom-left-radius: 7px; -khtml-border-bottom-left-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -webkit-border-bottom-right-radius: 7px; -o-border-bottom-right-radius: 7px; -ms-border-bottom-right-radius: 7px; -khtml-border-bottom-right-radius: 7px; border-bottom-right-radius: 7px; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #b1c0c5), color-stop(100%, #7f9198)); background-image: -webkit-linear-gradient(#b1c0c5, #7f9198); background-image: -moz-linear-gradient(#b1c0c5, #7f9198); background-image: -o-linear-gradient(#b1c0c5, #7f9198); background-image: -ms-linear-gradient(#b1c0c5, #7f9198); background-image: linear-gradient(#b1c0c5, #7f9198); }
|
||||
.cms table.ss-gridfield-table tr td.bottom-all .datagrid-footer-message { text-align: center; padding-top: 6px; color: white; }
|
||||
.cms table.ss-gridfield-table tr td.bottom-all .datagrid-pagination { padding-top: 2px; position: absolute; left: 50%; margin-left: -116px; }
|
||||
.cms table.ss-gridfield-table tr td.bottom-all .datagrid-pagination .pagination-page-number { color: white; }
|
||||
.cms table.ss-gridfield-table tr td.bottom-all .datagrid-pagination .pagination-page-number input { width: 35px; height: 18px; margin-bottom: -6px; padding: 0px; }
|
||||
|
42
forms/gridfield/GridFieldFooter.php
Normal file
42
forms/gridfield/GridFieldFooter.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Adding this class to a {@link GridFieldConfig} of a {@link GridField} adds a footer bar to that field.
|
||||
* The footer looks just like the {@link GridFieldPaginator} control, except without the pagination controls.
|
||||
* It only display the "Viewing 1-8 of 8" status text and (optionally) a configurable status message.
|
||||
*
|
||||
* The purpose of this class is to have a footer that can round off GridField without having to use pagination.
|
||||
*
|
||||
* @package sapphire
|
||||
* @subpackage gridfield
|
||||
*/
|
||||
class GridFieldFooter implements GridField_HTMLProvider {
|
||||
|
||||
/**
|
||||
* @var string - a message to display in the footer
|
||||
*/
|
||||
protected $message = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $message - a message to display in the footer
|
||||
*/
|
||||
public function __construct($message = null) {
|
||||
if($message) $this->message = $message;
|
||||
}
|
||||
|
||||
|
||||
public function getHTMLFragments($gridField) {
|
||||
$count = $gridField->getList()->count();
|
||||
|
||||
$forTemplate = new ArrayData(array(
|
||||
'Message' => $this->message,
|
||||
'FirstShownRecord' => 1,
|
||||
'LastShownRecord' => $count,
|
||||
'NumRecords' => $count
|
||||
));
|
||||
|
||||
return array(
|
||||
'footer' => $forTemplate->renderWith('GridFieldFooter', array('Colspan'=>count($gridField->getColumns()))),
|
||||
);
|
||||
}
|
||||
}
|
@ -471,6 +471,11 @@ $gf_grid_x: 16px;
|
||||
&.bottom-all {
|
||||
@include border-bottom-radius($gf_border_radius);
|
||||
@include background-image(linear-gradient($gf_colour_gradient_light, $gf_colour_gradient_dark));
|
||||
.datagrid-footer-message {
|
||||
text-align: center;
|
||||
padding-top: 6px;
|
||||
color:$color-text-light;
|
||||
}
|
||||
.datagrid-pagination {
|
||||
padding-top:2px;
|
||||
position:absolute;
|
||||
|
9
templates/Includes/GridFieldFooter.ss
Normal file
9
templates/Includes/GridFieldFooter.ss
Normal file
@ -0,0 +1,9 @@
|
||||
<tr>
|
||||
<td class="bottom-all" colspan="$Colspan">
|
||||
<span class="pagination-records-number">$FirstShownRecord - $LastShownRecord of $NumRecords</span>
|
||||
|
||||
<% if Message %>
|
||||
<div class="datagrid-footer-message">$Message</div>
|
||||
<% end_if %>
|
||||
</td>
|
||||
</tr>
|
Loading…
Reference in New Issue
Block a user