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

added the option to select a folder on the editablefilefield #177

Closed
wants to merge 3 commits into from

Conversation

roed
Copy link

@roed roed commented Dec 3, 2013

this fix adds the option to select a folder. I tried to do it with a TreeDropdownField, but that one didn't work. A treedropdownfield needs a form, because it tries to call the 'tree' action. I used a dropdownfield instead.

There is also an issue for this pull request:
#20

@roed
Copy link
Author

roed commented Dec 12, 2013

is this going to be added or do I need to make some changes before it can be added? I discovered we needed this functionality in more projects and it would be great if the code for selecting an upload folder is default in the userforms module.


$folder = ($this->getSetting('Folder')) ? $this->getSetting('Folder') : '';

$folderList = array();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this code for getting folders as an array into a separate method with appropriate extend hooks to make it easier to write unit tests for and other services to modify / extend (e.g subsite module may want to modify this source list).

@wilr
Copy link
Member

wilr commented Dec 12, 2013

Thanks @roed, yes I've added a few comments inline before I merge. Cheers

Code for generating the folder list has been moved to a seperate method, with the option to extend the list. Also a check has been added to check if the folder still exists.
@roed
Copy link
Author

roed commented Dec 12, 2013

@wilr I've made some changes as you suggested. Can you check if this is wat you meant?

@roed
Copy link
Author

roed commented Dec 19, 2013

@wilr do I have to make more changes, or is the commit above enough?

@wilr
Copy link
Member

wilr commented Dec 20, 2013

Thanks @roed, I applied the patch to one of our larger userforms sites and noticed that the dropdown got a bit of a mission so got TreeDropdownField's working (at least in my tests) in my commit (07c159c). Give that a blast and let me know if that works! few style issues at the moment.

@wilr wilr closed this Dec 20, 2013
@roed
Copy link
Author

roed commented Dec 20, 2013

it works in my project also (except for the styling). This is a good solution!

NightJar pushed a commit to NightJar/silverstripe-userforms that referenced this pull request Oct 31, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants