Node relationships is great, but after adding "Create and reference" and "Edit reference" options, it seems that one more is missing - the ability to delete a relationship.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markus_petrux’s picture

Status: Active » Postponed

Sounds reasonable. Sadly, I do not have time. Do you plan to work on this feature? If not, I think we can leave this f.r. open for a while to see if someone else is interested in working on it.

phayes’s picture

Also, once we have a delete button, the ability to hide the text-field input element might be useful. In combo with http://drupal.org/project/reference_preview, users will be able to search, add, edit, and preview node-references with no typing. It's not ideal for everyone, but it's the interface I will need.

markus_petrux’s picture

Status: Postponed » Closed (won't fix)

I'm going to mark this issue as won't fix because it looks to me such a feature will confuse users [1], and the alternative workflow is simple enough and clear [2].

[1] Confuse because a button to remove a reference could mean just that, or it could also mean to remove the referred node. Not easy to explain the difference to all potential users of the module.

[2] Alternatively, you can enable the "View reference in new window", and the user can use it to see the Delete node button in that page. Once the node is deleted, if you use the Referential Integrity for CCK module, it can set the Node Reference field to NULL in the node delete operation. And a refresh of the original page should show updated information.

It seems to me the alternative approach [2] is so easy and clear that it does not worth to spend the time coding something that could be confusing.

The issue could be re-opened if/when someone can come up with a patch for review. The feature would have to be optional, and it should be easy and clear for the user to understand what the button would do.

jaxpax’s picture

Status: Closed (won't fix) » Active

I'm with kiprasm regarding the possibility to remove a relationship item, but I can see the possible confusion that markus_petrux is referring to in #3 [1]. I would like to see the possibility to remove an item from the list of related nodes, while in node add/edit, with the help of a button, next to the other buttons. This would be a real enhancement from a usability point of view. Now one would have to go through the "search multiple item" -button to accomplish the same thing. The feature is actually there already but it's hidden and it's not so clear how to reach it. It's just a matter of having the same possibility from another view as well.

I think that it's just a matter of how one would formulate the feature, so that users and end users would know the actual purpose of the feature. One would have to formulate that the button only removes this one instans of the node from the list of related nodes, and is not deleting anything.

If a user/end user would miss out on the real action of the feature, than the worst that could happen is just that an instans of a node is removed, nothing gets deleted anyway.

stefan81’s picture

FileSize
3.44 KB

A few ideas towards usability:

the button could be "clear" or "unlink".
Instead of an "x" icon a "-" or "unchain" icon would probably be better interpreted. (see attachment)

as a relation can be undone simply by deleting the text in the input field,
I think the job could be done with a small javascript that clears the input field on click.

jaxpax’s picture

@stefan81
Great ideas, simple and clear for everybody to understand. Nice touch with the icons.

-Patrik

Erik Seifert’s picture

Patch for a button to remove a relationship ( it simple remove field content not more! )

You can add this functionality on settings page for a field ( nodereference extras ).

You must copy attached image to: noderelationships\images

Erik Seifert’s picture

Sorry forgot to remove a dpm call.

@See #7

vurt’s picture

Tested against the stable version: works as expected!

Thank you Erik!

isaac77’s picture

+1

This is a great addition, improves usability a lot. Applied patch to 6.x-1.6, and it is working as expected.

doublejosh’s picture

Would be great to have the ability to enable "Add new item" without having to also allow "Create and Reference."

This with patch it could enable "Delete | Edit" and "Add another" below.

... like a node reference spreadsheet :)

doublejosh’s picture

FileSize
237.3 KB

Here's an image to illustrate the goal I'm referring to.

Erik Seifert’s picture

Better take #5, because you do not delete a reference. You unlink a reference.

doublejosh’s picture

Seeing the nuances of this issue now.

There is no "Delete" button while in the reference node edit modal as discussed in #3.
Seems like without this patch the only way to remove a reference or the referenced node is to delete the text in the autocomplete field.

Am I missing something?

In my use case relationships are a one-to-many so unlinking will be a delete action. (Looking at Referential Integrity for CCK.)
Though I suppose this thread might be headed toward a different use case.

hefox’s picture

Status: Active » Needs work

Why was this at 'active'?

Sounds like debating still so set it to needs work.

Edit: Patch works so far for me.

hefox’s picture

Title: Please add support for removing relationships » Add remove/unlink option to remove value of nodereference field
Status: Needs work » Needs review

Since it looks like the patch in #7 is ready to review, setting it to that (or am I missing something in the back and force above) and trying to clearify the title.

greggles’s picture

Status: Needs review » Needs work

This doesn't apply to the dev from 2010, so I'm guessing it doesn't apply to head.

That said, I would really like to be able to remove a relationship. I think it's more confusing that it's missing...

hefox’s picture

FileSize
9.22 KB

Not updated to -dev yet, but small update to change delete to remove; if not using delete icon, shouldn't say delete, nay? Unlink sounds confusing, so put remove for now. shrug.

markus_petrux’s picture

How does this button look when used with CCK3, that already provides a button to remove items in a multiple value field?

art is code’s picture

Title: Add remove/unlink option to remove value of nodereference field » Parse error with pathc #7 & #8 & #18

Hi,
Although everyone seems to apply the above mentioned patch successfully, I get the following parse error :

Parse error: syntax error, unexpected T_VAR in /var/www/sites/all/modules/noderelationships/noderelationships.module on line 277

Line 277 has the following variable :

var $deleteButton = $(Drupal.theme('nodeRelationshipsReferenceButton', 'delete', Drupal.t('Delete reference')));

I have to say it's the first time I see jQuery code included in a php file this way, and can't manage to debug this.

Thanks for possible clues !

Erik Seifert’s picture

There is something going wrong how do you patch this module. This code should applied to node_form.js . Not for the module. Have a look in the patch file:

Index: sites/all/modules/base/noderelationships/js/node_form.js
===================================================================
--- sites/all/modules/base/noderelationships/js/node_form.js	(revision 23577)
+++ sites/all/modules/base/noderelationships/js/node_form.js	(working copy)
@@ -139,6 +139,30 @@
         return false;
       });
     }
+    
+    if (fieldOptions.deleteReference) {
+        var $deleteButton = $(Drupal.theme('nodeRelationshipsReferenceButton', 'delete', Drupal.t('Delete reference')));
+        $buttonsWrapper.append($deleteButton);
+        $deleteButton.bind('click', function() {
+          $nodereference.val("").trigger('change');
+          return false;
+        });
......
hefox’s picture

Title: Parse error with pathc #7 & #8 & #18 » Add remove/unlink option to remove value of nodereference field

The "Issue title" field is for the issue title, it's not a comment title.

chrisschaub’s picture

Version: 6.x-1.6 » 6.x-1.x-dev
Status: Needs work » Needs review
FileSize
7.39 KB

I'm uploading patch #18 re-made against the latest 6.x-.1.x-dev branch. Seems to work for me. You also need the noderef-sprites.png image attached in number #8 put in your images directory.

chak_boss’s picture

How can i do like this in drupal 7. Am very eagerly waiting to do this in drupal 7.
Can any one help me in this.

Thanks in advance.