This was a great little feature of the original module, that died with the (much needed) reduction in ajax calls. Seems like this could be pretty easily accomplished with the JS, but is that the best solution? I'm concerned about keeping pace with #1514558: widget doesn't work without javascript, which looks to reduce JS dependence.

CommentFileSizeAuthor
#3 erb_toggle_1561484.patch1.42 KBjason.fisher

Comments

davidseth’s picture

Yes, I was thinking about this as well. I think a simple JS solution is the way to go. And when a filter is applied or paging, the system does pass in currently selected IDs so they will be excluded.

And the issue you refer to #1514558 will most likely be best solved with a simple fallback to select lists or something. I need to look at what Drupal does for their autocomplete boxes when the system falls back to no JS.

If I have time I will try to tackle this sometime this week, but patches are always welcome in the meantime! :)

ohthehugemanatee’s picture

Sadly I'm useless at JS... but I'm actively using this project on a site to reference users, so I will send in patches as I write them!

jason.fisher’s picture

Status: Active » Needs work
StatusFileSize
new1.42 KB

- added context to the body delegate tags, which corrected a double execution issue that showed itself after adding toggle. This should help performance after many clicks on large forms.

- added "picked" class toggle. When you click on a.picker, it becomes a.picker.picked. When you click again, it returns to a.picker and the list element is also removed.

The selected list element can then be hidden with CSS if you do not need it visually.

This patch should apply to the latest sandbox release.. I did not try applying it myself though.

Regards,
Jason Fisher

davidseth’s picture

Hello @jason.fisher, thanks for the great patch. I will review and see if it works.

gunwald’s picture

I think, it would be much better to add a class to the selected entities, so you can decide with css whether to hide or to mark them as active: http://drupal.org/node/1921316

jason.fisher’s picture

Aren't we doing the same thing? Just with addClass/removeClass vs toggleClass?

jason.fisher’s picture

"selected" is probably a better class name than "picked" ..

gunwald’s picture

You are right! I did not look into your code, I had written my weeks ago and did realize, that your post treats the same issue, only after having done my post.