mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Clean up
This commit is contained in:
parent
5437424b7e
commit
38d05df2ec
@ -9,17 +9,21 @@
|
||||
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('delete');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'delete' => 'delete'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Delete the selected records passed from the delete bulk action
|
||||
*
|
||||
|
@ -9,13 +9,15 @@
|
||||
class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('edit', 'update');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'bulkedit/update' => 'update',
|
||||
|
@ -9,17 +9,21 @@
|
||||
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('unlink');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'unlink' => 'unlink'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Unlink the selected records passed from the unlink bulk action
|
||||
*
|
||||
|
@ -11,7 +11,6 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
/**
|
||||
* component configuration
|
||||
*
|
||||
* 'imageFieldName' => field name of the $has_one Model Image relation
|
||||
* 'editableFields' => fields editable on the Model
|
||||
* 'readOnlyFieldClasses' => field types that will be converted to readonly
|
||||
* 'fieldsNameBlacklist' => fields that will be removed from the automatic form generation
|
||||
@ -34,6 +33,12 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
protected $readOnlyFieldClasses = array('GridField', 'UploadField');
|
||||
|
||||
|
||||
/**
|
||||
* GridFieldBulkManager component constructor
|
||||
*
|
||||
* @param array $editableFields List of editable fields
|
||||
* @param boolean $defaultActions Use default actions list. False to start fresh.
|
||||
*/
|
||||
public function __construct($editableFields = null, $defaultActions = true)
|
||||
{
|
||||
if ( $editableFields != null ) $this->setConfig ( 'editableFields', $editableFields );
|
||||
@ -113,6 +118,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns one $config parameter of the full $config
|
||||
*
|
||||
@ -125,6 +131,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
else return $this->config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a field to the editable fields blacklist
|
||||
*
|
||||
@ -136,6 +143,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return array_push( $this->config['fieldsNameBlacklist'], $fieldName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a class to the readonly list
|
||||
*
|
||||
@ -147,6 +155,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return array_push( $this->config['readOnlyFieldClasses'], $className);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a field to the editable fields blacklist
|
||||
*
|
||||
@ -162,6 +171,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a class to the readonly list
|
||||
*
|
||||
@ -270,6 +280,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
if(!in_array('BulkSelect', $columns)) $columns[] = 'BulkSelect';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Which columns are handled by the component
|
||||
*
|
||||
@ -281,6 +292,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return array('BulkSelect');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the column's content
|
||||
*
|
||||
@ -297,6 +309,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return $cb->Field();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the column's HTML attributes
|
||||
*
|
||||
@ -310,6 +323,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return array('class' => 'col-bulkSelect');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the column's meta data
|
||||
*
|
||||
@ -402,6 +416,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pass control over to the RequestHandler
|
||||
* loop through the handlers provided in config['actions']
|
||||
|
@ -24,7 +24,9 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
'sequentialUploads' => false
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Component constructor
|
||||
*
|
||||
* @param string $fileRelationName
|
||||
* @param string/array $editableFields
|
||||
@ -68,6 +70,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
$this->config[$reference] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns one $config parameter of the full $config
|
||||
*
|
||||
@ -118,6 +121,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
return $configFileRelationName ? $configFileRelationName : $this->getDefaultFileRelationName($gridField);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the ClassName of the fileRelation
|
||||
* i.e. 'MyImage' => 'Image' will return 'Image'
|
||||
@ -279,6 +283,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pass control over to the RequestHandler
|
||||
*
|
||||
@ -294,4 +299,3 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
return $handler->handleRequest($request, DataModel::inst());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,6 @@
|
||||
/**
|
||||
* Handles request from the GridFieldBulkUpload component
|
||||
*
|
||||
* Handles:
|
||||
* * Form creation
|
||||
* * file upload
|
||||
* * editing and cancelling records
|
||||
*
|
||||
* @author colymba
|
||||
* @package GridFieldBulkEditingTools
|
||||
* @subpackage BulkUpload
|
||||
@ -14,45 +9,46 @@
|
||||
class GridFieldBulkUpload_Request extends RequestHandler
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Gridfield instance
|
||||
* @var GridField
|
||||
*/
|
||||
protected $gridField;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var GridField_URLHandler
|
||||
* Bulk upload component
|
||||
* @var GridFieldBulkUpload
|
||||
*/
|
||||
protected $component;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gridfield Form controller
|
||||
* @var Controller
|
||||
*/
|
||||
protected $controller;
|
||||
|
||||
/**
|
||||
* Cache the records FieldList from getCMSfields()
|
||||
*
|
||||
* @var FieldList
|
||||
*/
|
||||
protected $recordCMSFieldList;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array(
|
||||
'upload', 'select', 'attach', 'fileexists'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'$Action!' => '$Action'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Handler's constructor
|
||||
*
|
||||
* @param GridFIeld $gridField
|
||||
* @param GridField_URLHandler $component
|
||||
|
@ -1,11 +1,6 @@
|
||||
(function($) {
|
||||
$.entwine('ss', function($) {
|
||||
|
||||
// start SS namespace overrides
|
||||
|
||||
|
||||
// end SS namespace overrides
|
||||
|
||||
|
||||
$.entwine('colymba', function($) {
|
||||
|
||||
@ -74,17 +69,6 @@
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Track completed uploads
|
||||
*//*
|
||||
$('li.ss-uploadfield-item.done').entwine({
|
||||
onmatch: function(){
|
||||
this.parents('ul.ss-uploadfield-files').trackProgress();
|
||||
},
|
||||
onunmatch: function(){},
|
||||
});*/
|
||||
|
||||
|
||||
/**
|
||||
* Update buttons state and progress info...
|
||||
*/
|
||||
|
@ -23,10 +23,8 @@ window.tmpl.cache['colymba-bulkuploaddownloadtemplate'] = tmpl(
|
||||
'<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
||||
'</div>' +
|
||||
'{% } else { %}' +
|
||||
//'<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' +
|
||||
'{% } %}' +
|
||||
'</div>' +
|
||||
'</li>' +
|
||||
'{% } %}'
|
||||
);
|
||||
//'<div class="ss-uploadfield-item-editform loading"><iframe frameborder="0" src="{%=file.edit_url%}"></iframe></div>' +
|
||||
|
Loading…
Reference in New Issue
Block a user