silverstripe / silverstripe-cms

Silverstripe CMS - this is a module for Silverstripe Framework rather than a standalone app. Use https://github.com/silverstripe/silverstripe-installer/ to set this up.
http://silverstripe.org/
BSD 3-Clause "New" or "Revised" License
515 stars 332 forks source link

[2012-08-05] Show Thumbnail for Images in existing file selection popup #527

Closed silverstripe-issues closed 11 years ago

silverstripe-issues commented 11 years ago

created by: @jakr (jak) assigned to: @jakr (jak) created at: 2012-08-05 original ticket: http://open.silverstripe.org/ticket/7738


When you create an ImageUploadField, there is an option to attach an existing Image. Selecting this option displays a popup with a form that allows you to browse for existing files. Currently, this form displays only filename and title. It would be nice, if this form would also display a thumbmail.

The list inside this form is a GridField (created by UploadField->getListField and accessible via the URL ItemEditForm/field/MyUploadField/select), so the easiest way to add thumbnails would be to add the static field $summary_fields to framework/model/Image:

public static $summary_fields = array(
    'StripThumbnail' => 'Thumbnail',
    'Name' => 'Name',
    'Title' => 'Title',
);

Another idea would be to add $summary_fields to /framework/filesystem/File instead. In this case, it could perhaps also include the information that AssetAdmin (cms/code/controllers/AssetAdmin) wants to display. Currently, AssetAdmin->getEditForm does this by calling GridFieldDataColumns->setDisplayFields:

$columns->setDisplayFields(array(
    'StripThumbnail' => '',
    // 'Parent.FileName' => 'Folder',
    'Title' => _t('File.Name'),
    'Created' => _t('AssetAdmin.CREATED', 'Date'),
    'Size' => _t('AssetAdmin.SIZE', 'Size'),
));
silverstripe-issues commented 11 years ago

comment by: @jakr (jak) created at: 2012-08-05


Created pull request for the first idea at https://github.com/silverstripe/sapphire/pull/696. I would like to discuss if it would be better to add summary_fields to File instead.

chillu commented 11 years ago

Fixed with https://github.com/silverstripe/silverstripe-framework/pull/2044