Permalink
Browse files

FIX: GridField button styling

Remove all top/bottom margins from buttons and apply to GridFieldButtonRow component. Ensure that all buttons are added to a suitable GridFieldButtonRow in ModelAdmin, SecurityAdmin and Group.
  • Loading branch information...
1 parent e908613 commit 3596892001b2cdd2f7d208e499878cec83040b21 Tom Densham committed Jun 21, 2013
@@ -67,7 +67,8 @@ public function getEditForm($id = null, $fields = null) {
false,
Member::get(),
$memberListConfig = GridFieldConfig_RecordEditor::create()
- ->addComponent(new GridFieldExportButton())
+ ->addComponent(new GridFieldButtonRow('after'))
+ ->addComponent(new GridFieldExportButton('buttons-after-left'))
)->addExtraClass("members_grid");
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -21,6 +21,7 @@ public function __construct($targetFragment = 'before') {
public function getHTMLFragments( $gridField) {
$data = new ArrayData(array(
+ "TargetFragmentName" => $this->targetFragment,
"LeftFragment" => "\$DefineFragment(buttons-{$this->targetFragment}-left)",
"RightFragment" => "\$DefineFragment(buttons-{$this->targetFragment}-right)",
));
@@ -53,7 +53,7 @@ public function getHTMLFragments($gridField) {
$button->setAttribute('data-icon', 'download-csv');
$button->addExtraClass('no-ajax');
return array(
- $this->targetFragment => '<p class="grid-bottom-button grid-csv-button">' . $button->Field() . '</p>',
+ $this->targetFragment => '<p class="grid-csv-button">' . $button->Field() . '</p>',
);
}
View
@@ -46,6 +46,18 @@ $gf_grid_x: 16px;
margin-bottom:$gf_grid_y;
}
}
+ &.ss-gridfield-buttonrow-before{
+ margin-bottom: 0;
+ .action {
+ margin-bottom:$gf_grid_y;
+ }
+ }
+ &.ss-gridfield-buttonrow-after{
+ margin-bottom: 0;
+ .action {
+ margin-top:$gf_grid_y;
+ }
+ }
}
&[data-selectable] {
@@ -116,7 +128,8 @@ $gf_grid_x: 16px;
width: 500px;
}
.grid-csv-button, .grid-print-button {
- margin-bottom: $gf_grid_y;
+ margin-bottom: 0;
+ font-size: $font-base-size;
@include inline-block();
}
}
@@ -641,8 +654,4 @@ $gf_grid_x: 16px;
border-right: 1px solid $gf_colour_border;
}
}
-
- .grid-bottom-button {
- margin-top:$gf_grid_y;
- }
}
View
@@ -96,8 +96,9 @@ public function getCMSFields() {
if($this->ID) {
$group = $this;
$config = new GridFieldConfig_RelationEditor();
- $config->addComponents(new GridFieldExportButton('after'));
- $config->addComponents(new GridFieldPrintButton('after'));
+ $config->addComponent(new GridFieldButtonRow('after'));
+ $config->addComponents(new GridFieldExportButton('buttons-after-left'));
+ $config->addComponents(new GridFieldPrintButton('buttons-after-left'));
$config->getComponentByType('GridFieldAddExistingAutocompleter')
->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email'));
$config->getComponentByType('GridFieldDetailForm')
@@ -1,4 +1,4 @@
-<div class="addNewGridFieldButton ss-gridfield-buttonrow">
+<div class="ss-gridfield-buttonrow ss-gridfield-buttonrow-{$TargetFragmentName}">
<div class="left">$LeftFragment</div>
<div class="right">$RightFragment</div>
</div>

0 comments on commit 3596892

Please sign in to comment.