Jump to:

22997 Posts in 11853 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » How to Increase has_many popup box (GreyBox?) size?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2092 Views
  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    How to Increase has_many popup box (GreyBox?) size? Link to this post

    Hi,

    I have a DataObjectParent with a has_many relation to another DataObjectChild. This, as a managed_model in ModelAdmin, creates a table where I can "Add DataObjectChild" and it pops up a window with the form. I think in a 'GreyBox'.

    Is there any way to set the default size a bit larger?

    Barry

  • mattclegg
    Avatar
    Community Member
    56 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    This is a really simple change, and I dont know why by default the popup is soo tiny?

    Open sapphire/thirdparty/greybox/greybox.js
    change line 214 tobe;

    GB_ONLY_ONE.setFullScreen(true);

    Enjoy full sized popups from any ComplexTableManager ie ModelAdmin/Security

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    Thanks for this info! Is there a way this can be done without hacking the core. Something like set_popup_width() in Dataobject Manager module?

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    I've found a nice way to do this... in MyLeftAndMainDecorator (that I use for stuff needed int eh CMS) add some script...

    class MyLeftAndMainDecorator extends LeftAndMainDecorator {
    function init() {
    Requirements::customScript("GB_show = GB_showFullScreen;");
    }
    }

    (needs "Object::add_extension('LeftAndMain', 'MyLeftAndMainDecorator');" in _config.php)

  • Tony C
    Avatar
    Community Member
    9 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    That has a SIDE EFFECT of not refreshing the main panel because the javascript has the wrong no. of params and doesn't call the callback_fn.

    The decorator is the right way to do it though, but it needs to be ....

    class MyLeftAndMainDecorator extends LeftAndMainDecorator {
       function init() {
          
          $custom = <<<JS
           GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
           GB_initOneIfNeeded();
           GB_ONLY_ONE.defaultSize();
           GB_ONLY_ONE.setFullScreen(true);
           GB_ONLY_ONE.setType("page");
           GB_ONLY_ONE.setCallback(callback_fn);
           GB_ONLY_ONE.show(caption, url);
           return false;
          };
    JS;
          
          // Requirements::customScript("GB_show = GB_showFullScreen;");
          Requirements::customScript( $custom );
       }
    }

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    Many thanks Tony for the tip!

  • SheaDawson
    Avatar
    Community Member
    45 Posts

    Re: How to Increase has_many popup box (GreyBox?) size? Link to this post

    That is infinitely better. Thanks guys!

    2092 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.