don't open in drawer

In Sugar 8.0.3, the create Contacts view (when accessed from the megamenu) opens in a drawer.

Client does NOT want this behavior.  Client wants the create view to be the main screen.  How can I stop this menu action from opening the view in a drawer?

The consequences of opening in a drawer are that upon save/create, the drawer closes and brings the user back to the previous page. They do not want this.

When you manually visit the create view by url, it takes up the main screen. Upon save/create, it takes you to the recordview of this new record. THIS is what the client wants by default.

  • Take a look at overriding the Contacts header menu file.

    See this example:

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.3/User_Interface/MegaMenu/

    One way would be to open new tab on the click by adding 'open window' => true. You may also need  to specify the full path in the route.

  • That's close.  The 'openwindow' option does work to open the url, but it opens a n entirely different window.  However, this isn't what I need.  I want to reuse the same window, just not open that view in a drawer.

    Thanks, though! That's a good find!

  • Hi Robert Cristof,

    This is the default behavior throughout the system. If you really want to override this, you need to extend the create view controller. Look out for saveAndClose function in clients/base/views/create/create.js.

    If you see the above screenshot (please ignore my weird highlighting), it checks if there is a drawer component available, if found, it will trigger the drawer close function which in turn returns to the same screen from where you open the drawer. Whereas, if you open the create link in new page, it doesn't append the drawer layout to the current layout components list because this action has not triggered from any other layout (triggered directly), hence else part get executed.

    So, if you completely wants to override this behavior, you can extend the create view at application level in custom/clients/base/views/create/create.js and override this function to comment out the if condition and just keep the else part (navigate to currently created record). This would work for all the modules within the application.

    ({
        extendsFrom: 'CreateView',
        initialize: function(options) {
         this._super('initialize', [options]);
        },

        //overridden to navigate user to record view
        saveAndClose: function () {
            this.initiateSave(_.bind(function () {
                app.navigate(this.context, this.model);
            }, this));
        }
    })

    If you just want to override this for contacts module, extend the Contacts module create controller in custom/modules/Contacts/clients/base/views/create/create.js.

    ({
        extendsFrom: 'ContactsCreateView',
        initialize: function(options) {
         this._super('initialize', [options]);
        },

        //overridden to navigate user to record view
        saveAndClose: function () {
            this.initiateSave(_.bind(function () {
                app.navigate(this.context, this.model);
            }, this));
        },
    })

    Let us know if this helps.

    Regards.

  • Hats,

    thanks for your reply, which solves part of the problem (the redirect after save) but I still want to avoid the drawer altogether for this reason:

    the previous view can be processing some other code (in this client's case, specifically, sitting in the phone queue and accepting inbound calls).  By opening in a drawer, the phone queue code is still running while the user enters data in this create view, which could lead to missed calls.

    I would still like to find the code responsible for the drawer and open the create view in a full screen.

    Regards,

    Robert

  • Hey Robert,

    I think to accomplish what you want you will need to look at overriding the route.

    Take a look at this documentation https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.3/User_Interface/Routes/#Custom_Routes

    And this line:

    include/javascript/sugar7.js:281 (For 8.3) compared to other examples that load a view instead of a drawer.

    Hope this helps.

  • That is EXACTLY what I needed. Works great! Thanks Shad!

    I was able to overwrite the default handler for create routes (though I could also make a new alternate create to selectively apply to header menus if I wanted to keep the original route handler for some modules).