I'm in the process of throwing together a view to serve as a tab on the media browser, it's pretty space intensive and having users having to scroll horizontally to access things, or crush it all together in a huge vertical stack is unacceptable.
I searched through the configuration options then out frustration I started looking at the module source. After a bit of poking around I found a hardcoded integer pixel value for the iframe width in the module code.
Is the only way to change this to actually hack the module? I'm submitting this as a support request because this seems like such a no-brainer I MUST be missing something really obvious. Please. Tell me I am.
Comment | File | Size | Author |
---|---|---|---|
#17 | media_browser_modal-2082045-17.patch | 806 bytes | lslinnet |
#16 | Screen Shot 2014-07-16 at 10.59.04.png | 504.94 KB | lslinnet |
#8 | media-expose-dialog-modal-settings-2082045-8.patch | 7.67 KB | swim |
Comments
Comment #1
steven.wichers CreditAttribution: steven.wichers commentedUnfortunately this seems to be the case.
#1517002: Adjust width of dialog box overlay didn't really fix anything, just ignored the fact that there is no good way to override these defaults.
In media.popups.js you have:
And that's what you get. You can't change them as far as I can tell. There are no drupal_alter() calls, they do not get merged into any other settings objects. They just get passed as-is into the stuff that actually creates the dialog.
Thankfully, because JavaScript is pretty loose in how you define functions, all you have to do is duplicate this code in your own JavaScript and change the default options. It's a little verbose, but it works.
Comment #2
Dr_Whut CreditAttribution: Dr_Whut commentedThen I motion that this be put forward as something that requires fixing, I would submit a patch myself but I'm still waist deep in the project that brought this to my attention in the first place.
Comment #3
blacklabel_tom CreditAttribution: blacklabel_tom commented+1 for this
One thing to think of is would you want the iFrame to ALWAYS be the same size? For example someone is (god forbid) uploading media from their tablet?
Cheers
Tom
Comment #4
blacklabel_tom CreditAttribution: blacklabel_tom commentedChanging to a feature request as it's not causing a bug, but would be very handy to have.
Comment #5
steven.wichers CreditAttribution: steven.wichers commentedIf you implement my above suggestion you do not have to hard code the width. You can specify a dynamic width via something like $(window).width() or a more advanced method. Do note that overall the media module has terrible mobile device support and you may run into issues using smaller sizes. Good luck if you have to support something like a Nexus 4.
Comment #6
steinmb CreditAttribution: steinmb commentedPatches are welcome :) but any patches must be rolled against dev.
Comment #7
swim CreditAttribution: swim commentedHey all,
I needed this functionality for v1 but created a port for v2. To this end I'll open another issue with a backport. Furthermore a second issue will need to be created to pass these attributes to the modal overlay - background color & opacity. It seems these settings are not taken from the dialogOptions array. However the rest should work as expected.
Hope this helps,
Comment #8
swim CreditAttribution: swim commentedAdded introduced variables to uninstall hook.
Comment #9
dddbbb CreditAttribution: dddbbb commentedJust stumbled across this thread, thought I'd chip in to say that I'd been running the following dubious CSS in my custom admin theme to get around this:
Having a less dubious solution would be great. Support for more than just fixed dimensions - percentages or relative to $(window).width() is essential IMHO.
Comment #10
mglamanTested, worked for me (Panopoly 1.6 demo site.) Super handy for solving z-index issues, and the ability to move it around.
Comment #12
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/ecab531.
Comment #13
swim CreditAttribution: swim commentedI hate to ask but can we please give proper git authorship? This patch took me a lot of time. There are also a lot of unknown git authors for media which makes it difficult to track.
Comment #14
aaron CreditAttribution: aaron commentedIs there a way to retroactively give attribution using git commit?
Comment #15
swim CreditAttribution: swim commented=P ignore me aaron, I was a little stressed that day. Let me know what you think of the current menu structure in this patch. We might be able to refactor it a little; maybe all under /media/media-manager - e.g. media/media-manager/browser-settings, media/media-manager/popup-settings.
Comment #16
lslinnet CreditAttribution: lslinnet commentedThere is an issue with this patch, when the media browser is opened the first time it works as expected, but if you insert an image/file/video either through upload or library selection, the default settings are added once again making the settings array contain multiple values of the dialogOptions elements, this makes the media browser behave very strangely as it does not get the correct values set for zindex and the others.
have attach an image showing you the problem.
I will try to fix it today, but not sure if I can identify exactly where the settings array gets corrupted.
Comment #17
lslinnet CreditAttribution: lslinnet commentedhave pinpointed the issue, when media_attach_browser_js is called multiple times the settings are added multiple times by deep array merging, basically ending up with a structure where you have multiple values per "value" in your settings array.
have "fixed" it by ensuring that the attach behavior is only executed once.
And here you go with a patch that fixes the cause of the issue .
Comment #18
sirtetThe CSS workaround in #9 works for me on alpha3.
Comment #19
boyan.borisov CreditAttribution: boyan.borisov commentedpatch from comment #17 works for me.
Comment #20
Marty2081 CreditAttribution: Marty2081 commentedThe patch from #17 fixes the issue I have using the Media browser on a multiple field within another overlay (panels IPE) where the z-index gets screwed up after adding "another item".
Comment #21
travelertt#17 Works for me as well
Comment #23
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/6850aa0.
Comment #25
kopeboy CreditAttribution: kopeboy commentedI have just upgraded to dev version from alpha-4 hoping to fix the issue with the modal width being more than 100% on small devices.
It did not fix. Am I supposed to set anything myself with JS or CSS?
Should I open a Support request issue?
More info:
I see a container with a fixed width of 500px and an iframe inside it with 100% width.
The container resizes automatically by changing the window width, but has a lower limit of 500px.
The (mobile) user cannot scroll horizontally, thus he can't close the dialog.
Comment #26
Devin Carlson CreditAttribution: Devin Carlson commentedComment #27
akalam CreditAttribution: akalam at Atenea tech commentedA simple css rule did the trick for me: