Active
Project:
Modal Nodereference
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Jul 2011 at 23:12 UTC
Updated:
4 Jul 2011 at 23:12 UTC
We extended a bit of code to add an edit link to a specific noderef field, but would love to see this functionality included in future releases of this module. The ultimate goal would be to see noderef come with this usability out of the box.
$('#field_news_instance_noderef_values .form-autocomplete').each(function() {
val = $(this).val();
if (val != '') {
nid = val.replace(/(.*)(\[nid:)(\d+)(\])(.*)/,'$3');
$(this).parent().append('<div id="edit_noderef_' + nid + '"><a class="edit_noderef_modal" href="/node/' + nid + '/edit">Edit node</a></div>');
}
});
// add modal to noderef edit links
// from modal_noderef
$('.edit_noderef_modal').click(function() {
$this = $(this);
var settings = {
autoResize: true,
autoFit: true,
width: 600,
height: 400
};
settings.url = $this.attr('href') || '#';
if (settings.url.indexOf('?') >= 0) {
settings.url += '&'
}
else {
settings.url += '?'
}
settings.url += 'automodal=true';
Drupal.modalFrame.open(settings);
return false;
});