mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Updated readme
Main components set and individual infos and examples
This commit is contained in:
parent
079fb7fa36
commit
00b8827dca
54
README.md
54
README.md
@ -1,31 +1,53 @@
|
||||
GridField Bulk Image Upload
|
||||
===========================
|
||||
|
||||
SilverStripe 3 GridField component for uploading images in bulk into the managed Model relation, with option to edit fields on the fly.
|
||||
This component takes bit and pieces around from CMSFileAddController, GridFieldDetailForm_ItemRequest, UploadField, and it overrides and adds some behaviors, templates and styles.
|
||||
GridField Bulk Editing Tools
|
||||
============================
|
||||
SilverStripe 3 GridField component set to facilitate bulk editing, adding and deletion of records.
|
||||
The Components take bit and pieces around from CMSFileAddController, GridFieldDetailForm_ItemRequest, UploadField, overrides and adds some behaviors, templates and styles...
|
||||
|
||||
## Requirments
|
||||
* SilverStripe 3.0
|
||||
|
||||
## Installation
|
||||
* Download and copy module in SilverStripe root directory under 'GridFieldBulkImageUpload'
|
||||
* Download and copy module in SilverStripe root directory and name it whatever you want
|
||||
* Run dev/build?flush=all to regenerate the manifest
|
||||
* run ?flush=all in CMS to force the templates to regenerate
|
||||
|
||||
#Bulk Image Upload
|
||||
A component for uploading images in bulk into the managed Model relation, with option to edit fields on the fly.
|
||||
|
||||
## Usage
|
||||
|
||||
### 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 it's editable db fields
|
||||
|
||||
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 it's editable CMS fields
|
||||
|
||||
$config->addComponent(new GridFieldBulkEditingTools());
|
||||
$config->addComponent(new GridFieldBulkImageUpload());
|
||||
|
||||
### Usage 2
|
||||
You can specify which Image field to use and which fields are editable from the managed Model
|
||||
$imageField (string): The name of the image field to use (should have 'ID' at the end: If your relation is set has 'MyImage' => 'Image', the parameter should be 'MyImageID')
|
||||
$editableFields (array): list of db fields name as string that will be editable like: array('myTextField', 'myVarcharField', 'myEnumField')
|
||||
|
||||
|
||||
$config->addComponent(new GridFieldBulkEditingTools());
|
||||
$config->addComponent(new GridFieldBulkImageUpload( $imageField, $editableFields ));
|
||||
|
||||
### Configuration
|
||||
The component's option can be configurated individually or in bulk through the 'config' functions
|
||||
|
||||
#### $config overview
|
||||
The available configuration options are:
|
||||
* 'imageFieldName' : sets the name of the Image field of the managed Model (i.e. 'MyImageID')
|
||||
* '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
|
||||
|
||||
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 )
|
||||
|
||||
### Sample Files
|
||||
|
||||
#### Page Model
|
||||
@ -43,6 +65,7 @@ $editableFields (array): list of db fields name as string that will be editable
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$config = GridFieldConfig_RelationEditor::create();
|
||||
$config->addComponent(new GridFieldBulkEditingTools());
|
||||
$config->addComponent(new GridFieldBulkImageUpload());
|
||||
$f = new GridField('Visuals', 'Case Study Visuals', $this->Visuals(), $config);
|
||||
$fields->addFieldToTab('Root.Visuals', $f);
|
||||
@ -89,12 +112,13 @@ $editableFields (array): list of db fields name as string that will be editable
|
||||
|
||||
## Notes
|
||||
* The HTML form fields for each editable fields are taken from the Model's getCMSFields() method
|
||||
* Only (HTML)Text/Varchar and Enum fields are picked up by the automatic config for now
|
||||
|
||||
## @TODO
|
||||
* Add option to specify upload folder
|
||||
# @TODO
|
||||
|
||||
## Bulk Editing Tools
|
||||
* Create the rest of the Components...
|
||||
|
||||
## Bulk Image Upload
|
||||
* Add individual actions for each upload (update + cancel)
|
||||
* Styles: fade progress bar back to blue once updated
|
||||
* Styles: add .loading class to buttons when saving/canceling
|
||||
* Handle and display errors better for: creation, update, cancel
|
||||
* Make it work not only for images -> might need to rename this component then?
|
||||
* Make it work not only for images -> might need to rename this component then? -> should be handled by another component
|
Loading…
Reference in New Issue
Block a user