How To Limit Media Picker Choices To Certain Media Type
Hi Umbracians,
I currently have a Razor view which gets a media picked property value and it expects to find a folder on this property, which is called "RightSidebarSections".
The code then takes a bunch of children elements from this folder with a DocumentTypeAlias "RightSidebarSection" (a custom defined media type). That's what it's hard coded to.
But there is nothing that will prevent the user from selecting a RightSidebarSection media type, rather than the folder that contains multiple of those.
I was hoping it's possible to force the user to only be able to pick a folder, or only multiple RightSidebarSection media types (using the multiple media picker).
It makes my coding life a lot easier knowing what my input will be.
What's the best practice for dealing with this situation? Is the only solution to make the code robust enough that it can handle multiple input types? Or is media picker choice limiting possible somehow?
You can make this kind of restriction using the Multinode Tree Picker instead of the Media Picker although that's a different UI experience.
Unless you fancy making your own custom version of the media picker (can be done) you will just need to make your code able to handle the incorrect selection.
Is it possible to remove the default 'Upload' block on the Media tab. I want my users to create any number of RightSidebarSection instances in the RightSidebarSections folder by clicking on the ... right next to RideSidebarSections.
I just know they will simply start clicking the giant upload control and then request support. But the whole goal is to reduce support requests.
In order to hide the upload button, I've tried display-noneing all of the "fileinput-button umb-upload-button-big"-occurences. I even tried commenting them out.
You'd think it's a pretty rigorous way of getting rid of an unwanted element. But it does not work. The upload button still appears.
I can tell from the disabled ng-class, that there is support for disabling the upload button.
How do I make this setting?
The "fileinput-button umb-upload-button-big" element is used in both the files folderbrowser.html as well as mediafolderbrowser.html. What's the difference between the two, anyway? Isn't all folder browsing in Umbraco related to media?
Removing the whole section in the dashboard works, but next to removing the upload button, it also removes the overview of all uploaded stuff directly beneath.
I've edited the mediafolderbrowser.html and the folderbrowser.html files to exclude the upload button. For some reason unbeknownst to me, the upload button magically appears anyway.
The dashboard.config only lets me remove the mediafolderbrowser, not the folderbrowser. I would really like the backoffice to pick up the edits I make in the html files, but it doesn't.
How To Limit Media Picker Choices To Certain Media Type
Hi Umbracians,
I currently have a Razor view which gets a media picked property value and it expects to find a folder on this property, which is called "RightSidebarSections".
The code then takes a bunch of children elements from this folder with a DocumentTypeAlias "RightSidebarSection" (a custom defined media type). That's what it's hard coded to.
But there is nothing that will prevent the user from selecting a RightSidebarSection media type, rather than the folder that contains multiple of those.
I was hoping it's possible to force the user to only be able to pick a folder, or only multiple RightSidebarSection media types (using the multiple media picker).
It makes my coding life a lot easier knowing what my input will be.
What's the best practice for dealing with this situation? Is the only solution to make the code robust enough that it can handle multiple input types? Or is media picker choice limiting possible somehow?
Sincerely,
Jay
Hi Jay,
You can make this kind of restriction using the Multinode Tree Picker instead of the Media Picker although that's a different UI experience.
Unless you fancy making your own custom version of the media picker (can be done) you will just need to make your code able to handle the incorrect selection.
Regards,
Jeavon
Thanks for the feedback. I have another question:
Is it possible to remove the default 'Upload' block on the Media tab. I want my users to create any number of RightSidebarSection instances in the RightSidebarSections folder by clicking on the ... right next to RideSidebarSections.
I just know they will simply start clicking the giant upload control and then request support. But the whole goal is to reduce support requests.
If you mean the dashboard that loads when you click on the Media section, then you can change this by editing /config/dashboards.config
In the dashboard.config file, all I see is this:
How can I modify this to hide the upload button?
In order to hide the upload button, I've tried display-noneing all of the "fileinput-button umb-upload-button-big"-occurences. I even tried commenting them out.
You'd think it's a pretty rigorous way of getting rid of an unwanted element. But it does not work. The upload button still appears.
I can tell from the disabled ng-class, that there is support for disabling the upload button.
How do I make this setting?
The "fileinput-button umb-upload-button-big" element is used in both the files folderbrowser.html as well as mediafolderbrowser.html. What's the difference between the two, anyway? Isn't all folder browsing in Umbraco related to media?
You can remove that whole section in dashboard.config or replace the view path with your own html file.
Removing the whole section in the dashboard works, but next to removing the upload button, it also removes the overview of all uploaded stuff directly beneath.
I've edited the mediafolderbrowser.html and the folderbrowser.html files to exclude the upload button. For some reason unbeknownst to me, the upload button magically appears anyway.
The dashboard.config only lets me remove the mediafolderbrowser, not the folderbrowser. I would really like the backoffice to pick up the edits I make in the html files, but it doesn't.
What can I do to fix this?
I see the html was merely being cached.
I got it working now by editing the upload button out of those html files.
Ah great, if you want to ensure you don't overwrite mediafolderbrowser.html when you upgrade Umbraco you could duplicate and rename the file.
Great tip, thanks.
is working on a reply...