Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jay 49 posts 211 karma points
    Dec 24, 2014 @ 12:55
    Jay
    0

    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

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Dec 24, 2014 @ 13:35
    Jeavon Leopold
    0

    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

  • Jay 49 posts 211 karma points
    Dec 29, 2014 @ 11:27
    Jay
    0

    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.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Dec 30, 2014 @ 12:23
    Jeavon Leopold
    0

    If you mean the dashboard that loads when you click on the Media section, then you can change this by editing /config/dashboards.config

  • Jay 49 posts 211 karma points
    Jan 06, 2015 @ 14:39
    Jay
    0

    In the dashboard.config file, all I see is this:

      <section alias="StartupMediaDashboardSection">
        <areas>
          <area>media</area>
        </areas>
        <tab caption="Content">
          <control showOnce="false" addPanel="false" panelCaption="">
            views/dashboard/media/mediafolderbrowser.html
          </control>
        </tab>
      </section>
    

    How can I modify this to hide the upload button?

  • Jay 49 posts 211 karma points
    Jan 06, 2015 @ 15:32
    Jay
    0

    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.

    <span class="fileinput-button umb-upload-button-big" ng-class="{disabled: disabled}" style="display:none;">
        <i class="icon icon-page-up"></i>
        <p><localize key="media_clickToUpload">Click to upload</localize></p>
        <input type="file" name="files[]" multiple ng-disabled="disabled">
    </span>
    

    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?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jan 06, 2015 @ 18:43
    Jeavon Leopold
    100

    You can remove that whole section in dashboard.config or replace the view path with your own html file.

  • Jay 49 posts 211 karma points
    Jan 07, 2015 @ 13:16
    Jay
    0

    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?

  • Jay 49 posts 211 karma points
    Jan 07, 2015 @ 13:33
    Jay
    0

    I see the html was merely being cached.

    I got it working now by editing the upload button out of those html files.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jan 07, 2015 @ 15:13
    Jeavon Leopold
    0

    Ah great, if you want to ensure you don't overwrite mediafolderbrowser.html when you upgrade Umbraco you could duplicate and rename the file.

  • Jay 49 posts 211 karma points
    Jan 09, 2015 @ 11:46
    Jay
    0

    Great tip, thanks.

Please Sign in or register to post replies

Write your reply to:

Draft