-
Notifications
You must be signed in to change notification settings - Fork 725
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
[RFR] Return to list view when deleting a record #642
Conversation
body = JSON.stringify(body); | ||
} | ||
|
||
this.back(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you go back in case of error? Doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of #538
But true, there will be another issue here: what about deleting a record from a reference_many list?
A solution may be to add a "with_redirect" to true by default, and open the confirmation box in a pop-up. Reference many delete button would not redirect in this case. What do you think of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove
One thing that concerns me is that if you're coming from a filtered list you'll lose the filter. I think you should be smarter and keep the |
After an IRL discussion, the most easy way to achieve it is to always redirect to the previous page. We only redirect to the list view if previous page has the same entity and id than the deleted object. In this case, previous view doesn't exist anymore, whatever it is (show or edition view). |
|
||
this.previousStateParametersDeferred = $q.defer(); | ||
$scope.$on('$stateChangeSuccess', (event, to, toParams, from, fromParams) => { | ||
console.log(fromParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console log spotted
Switching to RFR. |
a7b85fa
to
2dadf40
Compare
Tests should now be green: I removed |
|
||
this.previousStateParametersDeferred = $q.defer(); | ||
$scope.$on('$stateChangeSuccess', (event, to, toParams, from, fromParams) => { | ||
this.previousStateParametersDeferred.resolve(fromParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about if I click a link in the navbar rather than deleting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to bind once, or stop the listener after deletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be unbound at controller destruction (as bound with $on
).
unit tests fail |
b925df3
to
e9a73af
Compare
Green! \o/ |
[RFR] Return to list view when deleting a record
Thanks! |
Needs to implement and fix tests.
Closes #641.