Skip to content

Commit

Permalink
Updated for gridfield-bulk-editing-tools v2
Browse files Browse the repository at this point in the history
  • Loading branch information
purplespider committed Aug 13, 2014
1 parent 6a01019 commit b8c0f3c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 53 deletions.
20 changes: 17 additions & 3 deletions code/PhotoGalleryPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',"
<h2>To upload new images:</h2>
<ol>
<li>1. Click the <strong>From your computer</strong> button above.</li>
<li>2. <strong>Locate and select</strong> the image(s) you wish to upload.</li>
<li>3. Click on <strong>Open/Choose</strong> and the image(s) will begin to upload.</li>
<li>4. If you wish to add several image captions, then once all the images have all uploaded, click on the <strong>Edit all</strong> button.</li>
<li>5. Click <strong>Finish</strong>.</li>
</ol>"));

$fields->renameField("Content", "Intro Text");

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*"
}
}
51 changes: 3 additions & 48 deletions css/cms.css
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}

0 comments on commit b8c0f3c

Please sign in to comment.