mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Readme update
This commit is contained in:
parent
fad9121dd1
commit
f8b90af40f
25
README.md
25
README.md
@ -1,46 +1,45 @@
|
||||
GridField Bulk Editing Tools
|
||||
============================
|
||||
Set of SilverStripe 3 GridField components to facilitate bulk image upload & record editing.
|
||||
Set of SilverStripe 3 GridField components to facilitate bulk file upload & record editing.
|
||||
![preview](screenshots/preview.png)
|
||||
|
||||
Components included:
|
||||
* [Bulk Image Upload](#bulk-image-upload): Upload multiple images at once into DataObjects with on the fly fields editing
|
||||
* [Bulk Upload](#bulk-upload): Upload multiple images or files at once into DataObjects
|
||||
* [Bulk Manager](#bulk-manager): Handles actions for multiple records straight from the GridField (comes with unlink, delete and edit)
|
||||
|
||||
[More screenshots here.](screenshots)
|
||||
|
||||
## Requirements
|
||||
* SilverStripe 3.1 (version master / 1.+)
|
||||
* SilverStripe 3.1 (version master / 2.+ / 1.+)
|
||||
* Silverstripe 3.0 (version [0.5](https://github.com/colymba/GridFieldBulkEditingTools/tree/0.5))
|
||||
|
||||
## Development notes
|
||||
The master branch will try to be compatible with the latest SilverStripe release/pre-release. Please submit pull request against the master branch. Older branches are kept for compatibility but may not be maintained.
|
||||
The master branch will try to be compatible with the latest SilverStripe release/pre-release. Please submit pull request against the master branch. Older branches are kept for compatibility but are not maintained.
|
||||
|
||||
## Installation
|
||||
* Download and copy module in SilverStripe root directory and name it whatever you want
|
||||
* run ?flush to regenerate the manifest
|
||||
* flush the manifest
|
||||
|
||||
## Bulk Image Upload
|
||||
Upload multiple images at once into DataObjects. Perfect for galleries and the like.
|
||||
## Bulk Upload
|
||||
Upload multiple images or files at once into DataObjects. Perfect for galleries and the like.
|
||||
|
||||
$config->addComponent(new GridFieldBulkImageUpload());
|
||||
$config->addComponent(new GridFieldBulkUpload());
|
||||
|
||||
See [BULK_IMAGE_UPLOAD.md](BULK_IMAGE_UPLOAD.md) for detailed configuration.
|
||||
See [BULK_UPLOAD.md](bulkUpload/BULK_UPLOAD.md) for detailed configuration.
|
||||
|
||||
## Bulk Manager
|
||||
Perform actions on multiple records straight from the GridField
|
||||
|
||||
$config->addComponent(new GridFieldBulkManager());
|
||||
|
||||
See [BULK_MANAGER.md](BULK_MANAGER.md) for detailed configuration.
|
||||
See [BULK_MANAGER.md](bulkManager/BULK_MANAGER.md) for detailed configuration.
|
||||
|
||||
## Notes
|
||||
* The Record edit form uses the Model's getCMSFields()
|
||||
## Interdependencies
|
||||
The `GridFieldBulkUpload` component makes use of `GridFieldBulkManager` to allow quick editing of the newly uploaded files. Although not nescessary for the component to work, adding `GridFieldBulkManager` too to your `GridFieldConfig` will give you this advantage.
|
||||
|
||||
#### @TODO
|
||||
* Add individual actions for each upload (update + cancel)
|
||||
* Handle and display errors better for: creation, update, cancel
|
||||
* Make it work not only for images but Files too
|
||||
|
||||
## Translations
|
||||
|
||||
|
@ -1,21 +1,21 @@
|
||||
# Bulk Manager
|
||||
Perform actions on multiple records straight from the GridField. Comes with unlink, delete and bulk editing but you can easily create/add your own.
|
||||
Perform actions on multiple records straight from the GridField. Comes with *unlink*, *delete* and bulk *editing*. You can also easily create/add your own.
|
||||
|
||||
## Usage
|
||||
Simply add GridFieldBulkManager to your GridFieldConfig
|
||||
Simply add component to your `GridFieldConfig`
|
||||
|
||||
$config->addComponent(new GridFieldBulkManager());
|
||||
|
||||
## Configuration
|
||||
The component's option can be configurated individually or in bulk through the 'config' functions like this:
|
||||
The component's options can be configurated individually or in bulk through the 'config' functions like this:
|
||||
|
||||
$config->getComponentByType('GridFieldBulkManager')->setConfig( $reference, $value );
|
||||
$config->getComponentByType('GridFieldBulkManager')->setConfig($reference, $value);
|
||||
|
||||
### $config overview
|
||||
The available configuration options are:
|
||||
* 'editableFields' : array of string referencing specific CMS fields available for editing
|
||||
* 'fieldsClassBlacklist' : array of string referencing types (ClassName) of fields that wont be available for editing
|
||||
* 'fieldsNameBlacklist' : array of string referencing the names of fields that wont be available for editing
|
||||
* 'readOnlyFieldClasses' : array of string referencing types (ClassName) of fields that will be transformed to read only (always includes `GridField` and `UploadField`)
|
||||
|
||||
## Custom actions
|
||||
You can remove or add individual action or replace them all via `addBulkAction()` and `removeBulkAction()`
|
||||
@ -30,12 +30,12 @@ You can omit the handler's class name and the front-end config array, those will
|
||||
* `$config = array( 'isAjax' => true, 'icon' => 'accept', 'isDestructive' => false )`
|
||||
|
||||
#### Custom action handler
|
||||
When creating your awn bulk action RequestHandler, you should extend `GridFieldBulkActionHandler` which will expose 2 usefull functions `getRecordIDList()` and `getRecords()` returning either and array with the selected records IDs or a DataList of the selected records.
|
||||
When creating your own bulk action `RequestHandler`, you should extend `GridFieldBulkActionHandler` which will expose 2 usefull functions `getRecordIDList()` and `getRecords()` returning either an array with the selected records IDs or a `DataList` of the selected records.
|
||||
|
||||
Make sue to the define your `$allowed_actions` and `$url_handlers`. See `GridFieldBulkActionEditHandler`, `GridFieldBulkActionDeleteHandler` and `GridFieldBulkActionUnlinkHandler` for examples.
|
||||
Make sure to define your `$allowed_actions` and `$url_handlers` on your custom bulk action handler. See `GridFieldBulkActionEditHandler`, `GridFieldBulkActionDeleteHandler` and `GridFieldBulkActionUnlinkHandler` for examples.
|
||||
|
||||
#### Front-end config
|
||||
The last component's parameter lets you pass an array with configuration options for the UI/UX:
|
||||
* `isAjax`: if true the action will be called via XHR request otherwise the broser will be redirected to the action's URL
|
||||
* `icon`: lets you define which icon to use when the action is selected (SilverStripe button icon name only)
|
||||
* `isDestructive`: if true a confirmation dialog will be shown before the action is processed
|
||||
The last `addBulkAction()` parameter lets you pass an array with configuration options for the UI/UX:
|
||||
* `isAjax`: if true the action will be called via XHR request otherwise the browser will be redirected to the action's URL
|
||||
* `icon`: lets you define which icon to use on the button when the action is selected (SilverStripe button icon name only)
|
||||
* `isDestructive`: if true, a confirmation dialog will be shown before the action is processed
|
@ -1,36 +0,0 @@
|
||||
# Bulk Image Upload
|
||||
A component for uploading images in bulk into the managed Model relation, with option to edit fields on the fly.
|
||||
|
||||
## Usage 1
|
||||
Simplest usage, add the component to your GridField as below. The component will find the first Image has_one relation on the managed Model and the record's editable CMS fields
|
||||
|
||||
$config->addComponent(new GridFieldBulkImageUpload());
|
||||
|
||||
## Usage 2
|
||||
You can specify which Image field to use and which fields are editable from the managed Model
|
||||
$fileRelationName (string, optional): The name of the File/Image field to use (If your relation is set has 'MyImage' => 'Image', the parameter should be 'MyImage')
|
||||
$editableFields (array, optional): list of db fields name as string that will be editable like: array('myTextField', 'myVarcharField', 'myEnumField')
|
||||
|
||||
$config->addComponent(new GridFieldBulkImageUpload( $fileRelationName, $editableFields ));
|
||||
|
||||
## Configuration
|
||||
The component's option can be configurated individually or in bulk through the 'config' functions like this:
|
||||
|
||||
$config->getComponentByType('GridFieldBulkImageUpload')->setConfig( $reference, $value );
|
||||
|
||||
### $config overview
|
||||
The available configuration options are:
|
||||
* 'fileRelationName' : sets the name of the File/Image field of the managed Model (i.e. 'MyImage')
|
||||
* 'editableFields' : array of string referencing specific CMS fields available for editing
|
||||
* 'fieldsClassBlacklist' : array of string referencing types (ClassName) of fields that wont be available for editing
|
||||
* 'fieldsNameBlacklist' : array of string referencing the names of fields that wont be available for editing
|
||||
* 'folderName' : name of the folder where the images should be uploaded
|
||||
* 'sequentialUploads' : boolean, if true files will be uploaded one by one
|
||||
* 'maxFileSize' : integer, maximum upload file size in bytes
|
||||
|
||||
Each option can be set through the component's method setConfig( $reference, $value )
|
||||
In addition, some configuration option can be set more specifically via individual methods:
|
||||
* addFieldNameToBlacklist( $fieldName )
|
||||
* addClassToBlacklist( $className )
|
||||
* removeFieldNameFromBlacklist( $fieldName )
|
||||
* removeClassFromBlacklist( $className )
|
28
bulkUpload/BULK_UPLOAD.md
Normal file
28
bulkUpload/BULK_UPLOAD.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Bulk Upload
|
||||
A component for uploading images and/or files in bulk into `DataObject` managed by the `GridField`.
|
||||
|
||||
## Usage 1
|
||||
Simplest usage, add the component to your `GridFieldConfig` as below. The component will find the first `Image` or `File` has_one relation to use on the managed `DataObject`.
|
||||
|
||||
$config->addComponent(new GridFieldBulkUpload());
|
||||
|
||||
## Usage 2
|
||||
You can specify which `Image` or `File` field to use.
|
||||
$fileRelationName (string, optional): The name of the `Image` or `File` has_one field to use (If your relation is set has 'MyImage' => 'Image', the parameter should be 'MyImage')
|
||||
|
||||
$config->addComponent(new GridFieldBulkUpload($fileRelationName));
|
||||
|
||||
## Configuration
|
||||
The component's option can be configurated individually or in bulk through the 'config' functions like this:
|
||||
|
||||
$config->getComponentByType('GridFieldBulkUpload')->setConfig($reference, $value);
|
||||
|
||||
### $config overview
|
||||
The available configuration options are:
|
||||
* 'fileRelationName' : sets the name of the `Image` or `File` has_one field to use (i.e. 'MyImage')
|
||||
* 'folderName' : name of the folder where the images or files should be uploaded
|
||||
* 'maxFileSize' : integer, maximum upload file size in bytes
|
||||
* 'sequentialUploads' : boolean, if true files will be uploaded one by one
|
||||
|
||||
## Bulk Editing
|
||||
To get a quick edit shortcut to all the newly upload files, please also add the `GridFieldBulkManager` component to your `GridFieldConfig`.
|
Loading…
Reference in New Issue
Block a user