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

Clicking the trash can button in a has_many relationship field deletes the object instead of removing the relationship. #1222

Open
RyanMadsen opened this issue Aug 14, 2017 · 3 comments

Comments

@RyanMadsen
Copy link

Clicking the trash can button in a has_many relationship field deletes the object instead of removing the relationship.
screen shot 2017-08-14 at 4 10 03 pm

If you click the ‘x’ button in the belongs_to relationship field instead, it correctly removes the relationship.
screen shot 2017-08-14 at 4 05 41 pm

Clicking the trash can button in a many_to_many relationship always works correctly and is the only way to remove the relationship.
screen shot 2017-08-14 at 4 10 23 pm

As a current work around for cms users that can't remember what which fields are each they can check for the ‘x’ button in a relationship field and if it isn’t there then click edit in the relationship fields so that they can check to see if is there. If there isn’t an ‘x’ button then that means it is a many_to_many relationship and can safely click the trash can button and save.

Is there a fix/patch for this in one of the versions of the locomotivecms? I couldn't find it referenced in the changelog.

@did did added the feature label Mar 9, 2018
@did
Copy link
Member

did commented Mar 9, 2018

@RyanMadsen are we prompting for a confirmation when you click on the trash icon? If so, I think the default behavior is okay (not ideal I agree). If not, we need to display one.
Best solution would be to describe the behavior in the content type.

@did did added the question label Mar 9, 2018
@RyanMadsen
Copy link
Author

RyanMadsen commented Mar 9, 2018

It was immediately deleting them without a confirmation prompt. I think the preferred solution is to replace the trash button with an 'x' button and have the 'x' button remove the relationship. Or even have both buttons available if you still want to delete items from there (including adding the confirmation prompt).

@did
Copy link
Member

did commented Mar 9, 2018

thanks @RamonPage for your answer. The right solution will be to have both ('x' + trash buttons). I've to dig into the code to see if that's possible.
Anyway, the simplest solution is to prompt for a confirmation.

@did did closed this as completed Mar 9, 2018
@did did reopened this Mar 9, 2018
@did did added this to the 4.1 milestone Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants