diff --git a/js/references-dialog.js b/js/references-dialog.js index a7756ed..e36a3a4 100644 --- a/js/references-dialog.js +++ b/js/references-dialog.js @@ -32,6 +32,7 @@ var target = $('#' + widget_settings.target); target.val(value); target.change(); + target.trigger('reference:update') } // If we have none of the above, we just insert the value in the item // that invoked this. @@ -39,6 +40,7 @@ var key_el = $('#' + key); key_el.val(value); key_el.change(); + key_el.trigger('reference:update') } } return false; diff --git a/js/search-reference.js b/js/search-reference.js index d9f5fe8..cc8b865 100644 --- a/js/search-reference.js +++ b/js/search-reference.js @@ -9,7 +9,7 @@ // JQuery.each() to freak ut.' var selector = null; if ($('table.views-table').size() > 0) { - selector = $('table.views-table tbody tr'); + selector = $('table.views-table tbody tr:not(.views-table-row-select-all)'); } else if ($('table.views-view-grid').size() > 0) { selector = $('table.views-view-grid td'); @@ -22,6 +22,7 @@ } selector.each(function(index) { $(this).click(function(e) { + e.preventDefault(); // Ignore if the element is a link. if (e.target && e.target.nodeName && e.target.nodeName.toLowerCase() !== 'a') { // Fetch the entity from wherever it might be. @@ -40,7 +41,7 @@ // For links within the Views table, or those with a destination // parameter, open in a new window instead. - if (href.indexOf('destination=') >= 0 || $(element).parents('table.views-table').size() > 0) { + if (href.indexOf('destination=') >= 0 || $(element).parents('table.views-table tbody').size() > 0) { $(element).attr('target', '_blank'); return; } @@ -55,4 +56,4 @@ }) } } -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/references_dialog.module b/references_dialog.module index ebaf1ae..f774762 100644 --- a/references_dialog.module +++ b/references_dialog.module @@ -238,8 +238,13 @@ function references_dialog_field_attachable_query($view) { * Return an array of supported widgets. */ function references_dialog_widgets() { - $widgets = module_invoke_all('references_dialog_widgets'); - backdrop_alter('references_dialog_widgets', $widgets); + $widgets = &backdrop_static(__FUNCTION__); + + if ($widgets === NULL) { + $widgets = module_invoke_all('references_dialog_widgets'); + backdrop_alter('references_dialog_widgets', $widgets); + } + return $widgets; }