From b8c0f3c7e90e44539bf9e09fa5753557d028a99e Mon Sep 17 00:00:00 2001 From: James Cocker Date: Wed, 13 Aug 2014 10:16:09 +0100 Subject: [PATCH] Updated for gridfield-bulk-editing-tools v2 --- code/PhotoGalleryPage.php | 20 ++++++++++++--- composer.json | 4 +-- css/cms.css | 51 +++------------------------------------ 3 files changed, 22 insertions(+), 53 deletions(-) diff --git a/code/PhotoGalleryPage.php b/code/PhotoGalleryPage.php index 4398845..8997699 100644 --- a/code/PhotoGalleryPage.php +++ b/code/PhotoGalleryPage.php @@ -25,17 +25,31 @@ public function getCMSFields() { } $gridFieldConfig = GridFieldConfig_RecordEditor::create(); - $gridFieldConfig->addComponent(new GridFieldBulkImageUpload()); + $gridFieldConfig->addComponent(new GridFieldBulkUpload()); + $gridFieldConfig->addComponent(new GridFieldBulkManager()); $gridFieldConfig->addComponent(new GridFieldGalleryTheme('Image')); - $gridFieldConfig->getComponentByType('GridFieldBulkImageUpload')->setConfig('folderName', "Managed/PhotoGalleries/".$this->ID."-".$this->URLSegment); + $bulkUpload = $gridFieldConfig->getComponentByType('GridFieldBulkUpload'); + $bulkUpload->setConfig('folderName', "Managed/PhotoGalleries/".$this->ID."-".$this->URLSegment); + $bulkUpload->setConfig('canAttachExisting',false); + $bulkUpload->setConfig('canPreviewFolder',false); $gridFieldConfig->removeComponentsByType('GridFieldPaginator'); $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder')); - $gridFieldConfig->addComponent(new GridFieldPaginator(30)); + $gridFieldConfig->addComponent(new GridFieldPaginator(100)); $gridFieldConfig->removeComponentsByType('GridFieldAddNewButton'); $gridfield = new GridField("PhotoGalleryImages", "Image Gallery", $this->PhotoGalleryImages()->sort("SortOrder"), $gridFieldConfig); $fields->addFieldToTab('Root.ImageGallery', $gridfield); + + $fields->addFieldToTab('Root.ImageGallery', new LiteralField('help'," +

To upload new images:

+
    +
  1. 1. Click the From your computer button above.
  2. +
  3. 2. Locate and select the image(s) you wish to upload.
  4. +
  5. 3. Click on Open/Choose and the image(s) will begin to upload.
  6. +
  7. 4. If you wish to add several image captions, then once all the images have all uploaded, click on the Edit all button.
  8. +
  9. 5. Click Finish.
  10. +
")); $fields->renameField("Content", "Intro Text"); diff --git a/composer.json b/composer.json index 50a8337..5d3cf8f 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "silverstripe/framework": "~3.1", "silverstripe/cms": "~3.1", "undefinedoffset/sortablegridfield": "*", - "colymba/gridfield-bulk-editing-tools": "*", - "colymba/gridfield-gallery-theme": "*" + "colymba/gridfield-bulk-editing-tools": "2.0.*", + "colymba/gridfield-gallery-theme": "1.0.*" } } \ No newline at end of file diff --git a/css/cms.css b/css/cms.css index 68e207f..fd6fcd5 100644 --- a/css/cms.css +++ b/css/cms.css @@ -1,53 +1,12 @@ .bulkUpload .ss-uploadfield-item-name b:after { content: ":"; } -.bulkManagerOptions { - display: none; -} - - -.bulkUpload .component div.ss-uploadfield .colymba-bulkupload-buttons .colymba-bulkupload-info { - color: #fff !important; -} - -.ss-uploadfield .ss-uploadfield-item .ss-uploadfield-item-info .ss-uploadfield-item-name .size { - color: #989898 !important; -} - -div.colymba-bulkupload-buttons button#action_Cancel.bulkUploadCancelButton { - display: none; -} - -.bulkUpload .component div.ss-uploadfield .ss-uploadfield-addfile .ss-uploadfield-item-info .ss-uploadfield-item-name { - margin-bottom: 5px !important; -} - -.bulkUpload .component div.ss-uploadfield .ss-uploadfield-files .ss-uploadfield-item .ss-uploadfield-item-info .ss-uploadfield-item-name .ss-uploadfield-item-status.ui-state-success-text { - /*color: #9ffa9d !important;*/ -} - -.bulkUpload .component div.ss-uploadfield .ss-uploadfield-files { - background-color: #fff !important; -} - -.bulkUpload .component div.ss-uploadfield .ss-uploadfield-files .ss-uploadfield-item .ss-uploadfield-item-info .ss-uploadfield-item-name .name { - color: #000 !important; -} - +.bulkManagerOptions, +div.colymba-bulkupload-buttons button#action_Cancel.bulkUploadCancelButton, .bulkUpload .component div.ss-uploadfield .ss-uploadfield-files .ss-uploadfield-item .ss-uploadfield-item-info .ss-uploadfield-item-name .size { - display:none !important; + display: none !important; } -.bulkUpload .component div.ss-uploadfield .ss-uploadfield-files .ss-uploadfield-item .ss-uploadfield-item-info .ss-uploadfield-item-name .ss-uploadfield-item-status.ui-state-success-text { - background-color: #298530; - border-radius: 10px; - color: #fff !important; - font-size: 95%; - height: 10px; - line-height: 1; - margin: 10px; - padding: 5px 8px; -} .bulkEditingFieldHolder h4 a { text-decoration: none !important; @@ -63,8 +22,4 @@ div.colymba-bulkupload-buttons button#action_Cancel.bulkUploadCancelButton { #Form_BulkEditingForm .bulkEditToggle { display: none !important; -} - -.colymba-bulkupload-buttons #action_ClearError { - display: none !important; } \ No newline at end of file