avo icon indicating copy to clipboard operation
avo copied to clipboard

feature: Custom path and message after create update and delete

Open Paul-Bob opened this issue 2 years ago • 2 comments

Description

Besides after_create_path and after_update_path it's possible now to override the method after_destroy_path. This three methods gives the path to redirect after the create, update and destroy succeed.

It's also possible to customize the messages for each action (create, update and destroy) success or fail by overriding:

  • Create Success -> create_success_message Error -> create_fail_message
  • Update Success -> update_success_message Error -> update_fail_message
  • Destroy Success -> destroy_success_message Error -> destroy_fail_message

Now it's possible to override completely the response of each CrUD action both on success and failure:

  • Create Success -> create_success_action Error -> create_fail_action
  • Update Success -> update_success_action Error -> update_fail_action
  • Destroy Success -> destroy_success_action Error -> destroy_fail_action

Fixes https://github.com/avo-hq/avo/issues/1008

Checklist:

  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] I have added tests that prove my fix is effective or that my feature works

Paul-Bob avatar Aug 11 '22 22:08 Paul-Bob

Code Climate has analyzed commit 6ce0aadf and detected 0 issues on this pull request.

View more on Code Climate.

codeclimate[bot] avatar Aug 11 '22 22:08 codeclimate[bot]

Codecov Report

Base: 94.29% // Head: 94.25% // Decreases project coverage by -0.04% :warning:

Coverage data is based on head (7929a43) compared to base (c48b47c). Patch coverage: 86.00% of modified lines in pull request are covered.

:exclamation: Current head 7929a43 differs from pull request most recent head 6ce0aad. Consider uploading reports for the commit 6ce0aad to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1139      +/-   ##
==========================================
- Coverage   94.29%   94.25%   -0.05%     
==========================================
  Files         546      547       +1     
  Lines       10864    10945      +81     
==========================================
+ Hits        10244    10316      +72     
- Misses        620      629       +9     
Impacted Files Coverage Δ
...ec/dummy/app/controllers/avo/courses_controller.rb 78.94% <66.66%> (-21.06%) :arrow_down:
app/controllers/avo/base_controller.rb 91.76% <78.72%> (-1.26%) :arrow_down:
spec/dummy/app/models/course.rb 93.33% <100.00%> (+0.47%) :arrow_up:
...atures/avo/exposed_methods_base_controller_spec.rb 100.00% <100.00%> (ø)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Aug 11 '22 22:08 codecov[bot]

Late to the party, but this is awesome, thank you !!

bear-in-mind avatar Aug 24 '22 08:08 bear-in-mind