Jump to content

Recommended Posts

Posted

Hello!

Thanks for the awesome front-end editor! Real difference maker when it comes to picking CMS.

However, there is one tiny drawback, which the client has brought up. When I am editing multiple fields in a modal, it would be awesome that on save it would close and also reload the page (so I could actually see the changes).

However, simply reloading location when the form is saved like that

        // click action to save edits
        $('.pw-edit-save').click(function () {
            $('.pw-editing:not(.pw-edit-InputfieldCKEditor)').blur();
            setTimeout(function () {
                inlineSaveClickEvent();
            }, 250);
            location.reload();
        });

not only leaves the modal open, but also does not update the fields initially.

Any advice?

Posted

For now I've added location reload to

    function modalInitEditableRegions() {

        var regions = $('.pw-edit-modal');
        if (!regions.length)
            return;

        $(document).on('pw-modal-closed', function (e, eventData) {
            if (eventData.abort)
                return; // modal.js populates 'abort' if "x" button was clicked
            var target = $(e.target);
            if (!target.is('.pw-edit-modal'))
                return;
            var targetID = target.attr('id');
            var viewURL = $('#pw-url').val();
            viewURL += (viewURL.indexOf('?') > -1 ? '&' : '?') + 'pw_edit_fields=' + target.attr('data-fields');
            setBusy(true);

            target.load(viewURL + ' #' + targetID, {}, function () {
                var t = $(this);
                var children = t.children();
                if (children.length) {
                    var html = t.children().html();
                    t.html(html);
                }
                t.trigger('pw-reloaded');
                setBusy(false);
                location.reload();
            });
        });
    }

but is there a good way to reload on actual save?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...