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

Set error flash when unsuccesful destroy using HTML format #3428

Merged

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Nov 15, 2019

Description

When destroying a resource using the admin resource controller and failing because of some before_destroy callback throwing :abort with an ActiveModel::Error, and using HTML, the user will now see an error message after being redirected to the list of resources.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

@mamhoff mamhoff changed the title Set error flash on impossible destroy html Set error flash when unsuccesful destroy using HTML format Nov 15, 2019
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks. I watched you doing this ;)

But there is one issue now on the success case

backend/app/controllers/spree/admin/resource_controller.rb Outdated Show resolved Hide resolved
@mamhoff mamhoff force-pushed the set-error-flash-on-impossible-destroy-html branch from 38f17e5 to e8629eb Compare November 15, 2019 13:03
Prior to this commit, the user would not get any error message when
trying to destroy a resource using HTML instead of JS. This fixes that.
@mamhoff mamhoff force-pushed the set-error-flash-on-impossible-destroy-html branch from e8629eb to 54f9000 Compare November 15, 2019 13:07
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Nice. Thanks

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

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

@mamhoff thank you 👍

@kennyadsl
Copy link
Member

Thanks, Martin!

@kennyadsl kennyadsl merged commit c30c7b6 into solidusio:master Nov 20, 2019
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.

4 participants