KickAssets icon indicating copy to clipboard operation
KickAssets copied to clipboard

File Renaming does not change Title

Open micahsheets opened this issue 14 years ago • 4 comments

I noticed that renaming a file or folder in KickAssetsAdmin changes the Name in the database but not the Title. This is a problem in the CMS when selecting a folder to insert an image from since the TinyMCE dropdown for selecting the image uses Title instead of Name. All the folders I created are listed as New-Folder still. I have fixed this by editing KickAssetAdmin.php.

public function updatefilename(SS_HTTPRequest $r) {
    if($file = DataObject::get_by_id("File", (int) $r->requestVar('fileid'))) {
        $file->setName($r->requestVar('new'));
        $file->Title = $r->requestVar('new'); // This is the new line so that Title gets updated as well.
        $file->write();
        $template = $file instanceof Folder ? "Folder" : "File";
        return $this->customise($this->getFields($file))->renderWith($template);
    }

}

micahsheets avatar Jan 17 '12 01:01 micahsheets

Especially bad when renaming folders. https://github.com/unclecheese/KickAssets/pull/34

mmichelli avatar Feb 03 '12 12:02 mmichelli

Has anyone found that adding this fix causes multiple copies of the same file to be uploaded when using drag and drop from outside the browser?

mlewis-everley avatar Feb 11 '12 22:02 mlewis-everley

I am having this same issue, when both creating new folders and renaming existing folders

surfjedi avatar Feb 15 '12 11:02 surfjedi

Should be fixed now in 969e3c64b7218bdcdf329f5c982ef4d95662563c

lingo avatar Apr 03 '12 20:04 lingo