Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where the 'changed' class on the form isn't removed after saving. #10

Closed

Conversation

silbinarywolf
Copy link

Fix bug where the 'changed' class on the form isn't removed after saving. If the form has a 'changed' class it tells the user that items aren't saved if they try to navigate away from the page.

This removes that class on creation of a gridfield SaveAllButton as the button gets recreated on the save action. Not super across how entwine works so there's probably a better solution, but I figure this will do.

Added to JS:

i(".js-mwm-gridfield-saveall").entwine({
            onmatch: function(){
                // Remove 'changed' state from form anytime a SaveAll button is created.
                i(this[0].form).removeClass('changed');
                this._super();
            }
        }),

Jake Bentvelzen added 2 commits June 16, 2016 11:00
…m anytime its created (since it recreates the entire gridfield after an action, it will remove the 'changed' state on save)
Copy link

@micschk micschk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified & working as it should, would be nice to have this PR merged

@silbinarywolf
Copy link
Author

@mi3ll Are you able to action this?

@mellm0 mellm0 closed this in f53b6cc May 5, 2017
@mellm0
Copy link
Contributor

mellm0 commented May 5, 2017

I don't think this works this way. If there are other fields apart from the GridField, and the save all button removes the changed class from the form, no message will come up when they change page and the changes will be lost.

I have added a flag if you want to have the 'Save All' button remove the changed class instead as a compromise.

Sorry for taking so long to reply.

EDIT: Ah, you probably would need this in ModelAdmin...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants