Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Renaming does not change Title #33

Open
micahsheets opened this issue Jan 17, 2012 · 4 comments
Open

File Renaming does not change Title #33

micahsheets opened this issue Jan 17, 2012 · 4 comments

Comments

@micahsheets
Copy link
Contributor

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);
    }

}
@mmichelli
Copy link
Contributor

Especially bad when renaming folders. #34

@mlewis-everley
Copy link

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?

@surfjedi
Copy link

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

@lingo
Copy link
Contributor

lingo commented Apr 3, 2012

Should be fixed now in 969e3c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants