Add bootstrap form styles to the bulk manager

This commit is contained in:
Robbie Averill 2017-01-16 21:04:46 +13:00
parent dad7850e0c
commit 57d7f6adee
10 changed files with 102 additions and 68 deletions

View File

@ -73,7 +73,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
$actions->push(
FormAction::create('doSave', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.SAVE_BTN_LABEL', 'Save all'))
->setAttribute('id', 'bulkEditingSaveBtn')
->addExtraClass('ss-ui-action-constructive')
->addExtraClass('btn btn-success')
->setAttribute('data-icon', 'accept')
->setUseButtonTag(true)
);
@ -81,7 +81,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
$actions->push(
FormAction::create('Cancel', _t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.CANCEL_BTN_LABEL', 'Cancel'))
->setAttribute('id', 'bulkEditingUpdateCancelBtn')
->addExtraClass('ss-ui-action-destructive cms-panel-link')
->addExtraClass('btn btn-danger cms-panel-link')
->setAttribute('data-icon', 'decline')
->setAttribute('href', $one_level_up->Link)
->setUseButtonTag(true)

View File

@ -299,16 +299,16 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
$dropDownActionsList = DropdownField::create('bulkActionName', '')
->setSource($actionsListSource)
->setAttribute('class', 'bulkActionName no-change-track')
->addExtraClass('bulkActionName no-change-track no-chosen')
->setAttribute('id', '');
$templateData = array(
'Menu' => $dropDownActionsList->FieldHolder(),
'Menu' => $dropDownActionsList,
'Button' => array(
'Label' => _t('GRIDFIELD_BULK_MANAGER.ACTION_BTN_LABEL', 'Go'),
'DataURL' => $gridField->Link('bulkAction'),
'Icon' => $this->config['actions'][$firstAction]['config']['icon'],
'DataConfig' => htmlspecialchars(json_encode($actionsConfig), ENT_QUOTES, 'UTF-8'),
'DataConfig' => json_encode($actionsConfig),
),
'Select' => array(
'Label' => _t('GRIDFIELD_BULK_MANAGER.SELECT_ALL_LABEL', 'Select all'),
@ -350,13 +350,13 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
* but have more specific path defined
*
* @param GridField $gridField
* @param SS_HTTPRequest $request
* @param HTTPRequest $request
*
* @return mixed
*/
public function handleBulkAction($gridField, $request)
{
$controller = $gridField->getForm()->Controller();
$controller = $gridField->getForm()->getController();
foreach ($this->config['actions'] as $name => $data) {
$handlerClass = $data['handler'];

View File

@ -31,12 +31,14 @@
text-shadow: none; }
.bulkEditingFieldHolder.updated .ui-accordion-header {
background-color: #a4ca3a;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #a4ca3a), color-stop(100%, #59781d));
background-image: -webkit-linear-gradient(top, #a4ca3a 0%, #59781d 100%);
background-image: -moz-linear-gradient(top, #a4ca3a 0%, #59781d 100%);
background-image: -o-linear-gradient(top, #a4ca3a 0%, #59781d 100%);
background-image: -ms-linear-gradient(top, #a4ca3a 0%, #59781d 100%);
background-image: linear-gradient(top, #a4ca3a 0%, #59781d 100%); }
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #a4ca3a), color-stop(100%, #59781D));
background-image: -webkit-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -moz-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -o-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -ms-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: linear-gradient(top, #a4ca3a 0%, #59781D 100%); }
.bulkEditingFieldHolder.updated .ui-accordion-header a {
color: #fff;
text-shadow: none; }
/*# sourceMappingURL=GridFieldBulkEditingForm.css.map */

View File

@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "AACA,eACA;EACC,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,GAAG;EAEV,MAAM,EAAE,aAAa;EAErB,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;;AAGlB,eACA;EACC,KAAK,EAAE,KAAK;EACZ,KAAK,EAAE,KAAK;EACZ,KAAK,EAAE,GAAG;EAEV,MAAM,EAAE,aAAa;EAErB,eAAe,EAAE,SAAS;EAC1B,UAAU,EAAE,KAAK;EACjB,MAAM,EAAE,OAAO;;AAGhB,uBACA;EACC,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,IAAI;EAEX,sDACA;IACC,gBAAgB,EAAE,OAAO;IAEzB,gBAAgB,EAAE,8FAA8F;IAChH,gBAAgB,EAAE,sDAAsD;IACxE,gBAAgB,EAAE,mDAAmD;IACrE,gBAAgB,EAAE,iDAAiD;IACnE,gBAAgB,EAAE,kDAAkD;IACpE,gBAAgB,EAAE,8CAA8C;IAEhE,wDACA;MACC,KAAK,EAAE,IAAI;MACX,WAAW,EAAE,IAAI;EAInB,oDACA;IACC,gBAAgB,EAAE,OAAO;IAEzB,gBAAgB,EAAE,8FAA8F;IAChH,gBAAgB,EAAE,sDAAsD;IACxE,gBAAgB,EAAE,mDAAmD;IACrE,gBAAgB,EAAE,iDAAiD;IACnE,gBAAgB,EAAE,kDAAkD;IACpE,gBAAgB,EAAE,8CAA8C;IAEhE,sDACA;MACC,KAAK,EAAE,IAAI;MACX,WAAW,EAAE,IAAI",
"sources": ["GridFieldBulkEditingForm.scss"],
"names": [],
"file": "GridFieldBulkEditingForm.css"
}

View File

@ -1,10 +1,12 @@
.cms table.ss-gridfield-table tr.bulkManagerOptions th.bulkmanagerselect {
.cms table.grid-field__table tr.bulkManagerOptions th.bulkmanagerheading {
padding-left: 40px; }
.cms table.grid-field__table tr.bulkManagerOptions th.bulkmanagerselect {
text-align: center; }
.cms table.ss-gridfield-table tr.bulkManagerOptions th.bulkmanagerselect input {
.cms table.grid-field__table tr.bulkManagerOptions th.bulkmanagerselect input {
margin-left: 0; }
.cms table.ss-gridfield-table tr.bulkManagerOptions .title {
.cms table.grid-field__table tr.bulkManagerOptions .title {
margin: 0 0 2px 2px; }
.cms table.ss-gridfield-table tr.bulkManagerOptions .dropdown {
.cms table.grid-field__table tr.bulkManagerOptions .dropdown {
display: inline-block;
border: none;
box-shadow: none;
@ -12,17 +14,17 @@
margin: 0;
color: #000;
vertical-align: top; }
.cms table.ss-gridfield-table tr.bulkManagerOptions .doBulkActionButton .ui-button-text {
.cms table.grid-field__table tr.bulkManagerOptions .doBulkActionButton .ui-button-text {
padding: 6px 0 5px 2.1em; }
.cms table.ss-gridfield-table tr.bulkManagerOptions .doBulkActionButton .ui-button-text .ui-button-text {
.cms table.grid-field__table tr.bulkManagerOptions .doBulkActionButton .ui-button-text .ui-button-text {
padding: 0; }
.cms table.ss-gridfield-table tr.bulkManagerOptions .doBulkActionButton .loading .ui-icon {
.cms table.grid-field__table tr.bulkManagerOptions .doBulkActionButton .loading .ui-icon {
background: transparent url(../../framework/images/network-save.gif) no-repeat 0 0; }
.cms table.ss-gridfield-table tbody .col-bulkSelect {
.cms table.grid-field__table tbody .col-bulkSelect {
width: 25px;
padding: 0 10px;
text-align: center; }
.cms table.ss-gridfield-table tbody td a.tempDisabledEditLink {
.cms table.grid-field__table tbody td a.tempDisabledEditLink {
background: url("../../framework/admin/images/btn-icon/document--pencil.png") no-repeat 2px 0px;
display: inline-block;
width: 20px;
@ -32,3 +34,5 @@
vertical-align: middle;
background-position: 2px 0px;
background-repeat: no-repeat no-repeat; }
/*# sourceMappingURL=GridFieldBulkManager.css.map */

View File

@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "AAII,wEAAsB;EAClB,YAAY,EAAE,IAAI;AAGtB,uEACA;EACE,UAAU,EAAE,MAAM;EAElB,6EACA;IACE,WAAW,EAAE,CAAC;AAIlB,yDACA;EACE,MAAM,EAAE,WAAW;AAGrB,4DACA;EACE,OAAO,EAAE,YAAY;EACrB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,IAAI;EAEhB,OAAO,EAAE,CAAC;EACV,MAAM,EAAE,CAAC;EAET,KAAK,EAAE,IAAI;EACX,cAAc,EAAE,GAAG;AAKnB,sFACA;EACE,OAAO,EAAE,eAAe;EAExB,sGACA;IACE,OAAO,EAAE,CAAC;AAId,wFACA;EACE,UAAU,EAAE,sEAAsE;AAOtF,kDACA;EACE,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,MAAM;EACf,UAAU,EAAE,MAAM;AAGpB,4DACA;EACE,UAAU,EAAE,mFAAmF;EAC/F,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,WAAW,EAAE,QAAQ;EACrB,QAAQ,EAAE,MAAM;EAChB,cAAc,EAAE,MAAM;EACtB,mBAAmB,EAAE,OAAO;EAC5B,iBAAiB,EAAE,mBAAmB",
"sources": ["GridFieldBulkManager.scss"],
"names": [],
"file": "GridFieldBulkManager.css"
}

View File

@ -1,7 +1,11 @@
.cms table.ss-gridfield-table
.cms table.grid-field__table
{
tr.bulkManagerOptions
{
th.bulkmanagerheading {
padding-left: 40px;
}
th.bulkmanagerselect
{
text-align: center;
@ -17,7 +21,7 @@
margin: 0 0 2px 2px;
}
.dropdown
.dropdown
{
display: inline-block;
border: none;
@ -71,4 +75,4 @@
background-repeat: no-repeat no-repeat;
}
}
}
}

View File

@ -1,5 +1,5 @@
(function($) {
$.entwine('ss', function($) {
(function($) {
$.entwine('ss', function($) {
$.entwine('colymba', function($) {
@ -34,14 +34,14 @@
onunmatch: function(){}
});
/**
* Bulkselect table cell behaviours
*/
$('td.col-bulkSelect').entwine({
onmatch: function(){
},
onunmatch: function(){
onunmatch: function(){
},
onmouseover: function(){
//disable default row click behaviour -> avoid navigation to edit form when clicking the checkbox
@ -59,20 +59,20 @@
}
});
/**
* Individual select checkbox behaviour
*/
$('td.col-bulkSelect input').entwine({
onmatch: function(){
},
onunmatch: function(){
onunmatch: function(){
},
onclick: function(e) {
$(this).parents('.ss-gridfield-table').find('input.bulkSelectAll').prop('checked', '');
$(this).parents('.grid-field__table').find('input.bulkSelectAll').prop('checked', '');
}
});
/**
* Bulkselect checkbox behaviours
@ -80,35 +80,35 @@
$('input.bulkSelectAll').entwine({
onmatch: function(){
},
onunmatch: function(){
onunmatch: function(){
},
onclick: function()
{
var state = $(this).prop('checked');
$(this).parents('.ss-gridfield-table')
$(this).parents('.grid-field__table')
.find('td.col-bulkSelect input')
.prop('checked', state)
.trigger('change');
},
getSelectRecordsID: function()
{
return $(this).parents('.ss-gridfield-table')
return $(this).parents('.grid-field__table')
.find('td.col-bulkSelect input:checked')
.map(function() {
.map(function() {
return parseInt( $(this).data('record') )
})
.get();
}
});
/**
* Bulk action dropdown behaviours
*/
$('select.bulkActionName').entwine({
onmatch: function(){
},
onunmatch: function(){
onunmatch: function(){
},
onchange: function(e)
{
@ -136,10 +136,10 @@
else{
$btn.removeClass('ss-ui-action-destructive');
}
}
}
});
/**
* bulk action button behaviours
@ -147,7 +147,7 @@
$('.doBulkActionButton').entwine({
onmatch: function(){
},
onunmatch: function(){
onunmatch: function(){
},
getActionURL: function(action, url)
{
@ -176,13 +176,13 @@
var $parent = $(this).parents('.bulkManagerOptions'),
action = $parent.find('select.bulkActionName').val(),
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID()
;
;
this.doBulkAction(action, ids);
this.doBulkAction(action, ids);
},
doBulkAction: function(action, ids, callbackFunction, callbackContext)
{
{
var $parent = $(this).parents('.bulkManagerOptions'),
$btn = $parent.find('a.doBulkActionButton'),
@ -190,7 +190,7 @@
url = this.getActionURL(action, $(this).data('url')),
data = { records: ids }
;
if ( ids.length <= 0 )
{
alert( ss.i18n._t('GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT') );
@ -207,10 +207,10 @@
callbackFunction.call(callbackContext, false);
}
return false;
}
}
}
}
$btn.addClass('loading');
$btn.addClass('loading');
if ( config[action]['isAjax'] )
{
@ -219,7 +219,7 @@
data: data,
type: "POST",
context: $(this)
}).done(function(data, textStatus, jqXHR) {
}).done(function(data, textStatus, jqXHR) {
$btn.removeClass('loading');
if ( callbackFunction && callbackContext )
{
@ -239,7 +239,7 @@
}
});
});
});
});
}(jQuery));

View File

@ -1,15 +1,25 @@
<tr class="bulkManagerOptions">
<th class="main bulkmanagerheading" colspan="$Colspan">
<p class="title"><% _t('GRIDFIELD_BULK_MANAGER.COMPONENT_TITLE', 'Modify one or more entry at a time.') %></p>
$Menu
<a data-url="$Button.DataURL" data-config="$Button.DataConfig" class="doBulkActionButton ss-ui-button" data-icon="$Button.Icon">
$Button.Label
</a>
</th>
<th class="main bulkmanagerselect">
<input class="no-change-track bulkSelectAll" type="checkbox" title="$Select.Label" name="toggleSelectAll" />
</th>
</tr>
<th class="main bulkmanagerheading" colspan="$Colspan">
<div class="row">
<p class="title"><% _t('GRIDFIELD_BULK_MANAGER.COMPONENT_TITLE', 'Modify one or more entry at a time.') %></p>
</div>
<div class="row">
<div class="form-inline">
$Menu
<a data-url="$Button.DataURL"
data-config="$Button.DataConfig"
class="doBulkActionButton btn btn-primary"
data-icon="$Button.Icon">
$Button.Label
</a>
<label class="form-check-label">
<input class="no-change-track bulkSelectAll form-check-input"
type="checkbox"
title="$Select.Label"
name="toggleSelectAll" />
<% _t('GRIDFIELD_BULK_MANAGER.SELECT_ALL_LABEL', '$Select.Label') %>
</label>
</div>
</div>
</th>
</tr>

View File

@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
"dev-feature/ss4-compat": "3.x-dev"
"dev-master": "3.x-dev"
}
},
"autoload": {