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.

Parents Reply Children
  • 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.