comparison noderef_view.js @ 2:25a0c2fcbcfb

Don't wrap the field in a div, it may cause problems. Instead, we just go back in the DOM 'till we find the div holding the real data. It's not really all that good, but, it seems to do the job.
author Franck Deroche <franck@defr.org>
date Fri, 23 Jan 2009 18:57:45 +0100
parents a3c1e224e807
children b4c1e3d5d5ce
comparison
equal deleted inserted replaced
1:71a07534c366 2:25a0c2fcbcfb
4 */ 4 */
5 Drupal.behaviors.noderef_view = function(context) { 5 Drupal.behaviors.noderef_view = function(context) {
6 $('.noderef_view_link', context).each(function(i, obj) { 6 $('.noderef_view_link', context).each(function(i, obj) {
7 $(obj).addClass('noderef_view_link_processed').click(function() { 7 $(obj).addClass('noderef_view_link_processed').click(function() {
8 // Get the wrapper 8 // Get the wrapper
9 var id = $(this).attr('rel'); 9 var wrapper = $(this).prev();
10 var wrapper = $('#' + id); 10 while (!wrapper.is('div')) {
11 wrapper = wrapper.prev();
12 }
11 13
12 // Suppress behavior if it was previsously attached 14 // Suppress behavior if it was previsously attached
13 $(document).unbind('popups_form_success.noderef_view'); 15 $(document).unbind('popups_form_success.noderef_view');
14 16
15 // And now bind it. This code will be executed after successful 17 // And now bind it. This code will be executed after successful