Idea: reference field on click options

Another option is to have inline js to make all ref fields open in a new tab by default. It’s otherwise a pain to find each iteration and set this way. I like copy/paste better. :wink:

(function(skuid){ var $ = skuid.$; // curry tastes good and is good for you too var curry = function( func ) { // the first parameter to this function is the function we are going to call // so we strip it off to get the remaining parameters var args = Array.prototype.slice.call(arguments, 1); // curry returns a function itself return function() { // when the function that was returned is called, we merge any parameters // that were passed originally to curry (minus the first param which was the function // itself) with any parameters that are being passed to this function // this allows us to support skuid adding parameters in the future and it // not impacting our renderer wrapper - Told you curry was good :) return func.apply(this, args.concat(Array.prototype.slice.call(arguments))); }; }; // get shorthand to the stock skuid field renderers var fieldRenderers = skuid.ui.fieldRenderers, REFERENCE = fieldRenderers.REFERENCE, originalRef = { read: REFERENCE.read , readonly: REFERENCE.readonly , edit: REFERENCE.edit }; var refRenderer = function(mode, field, value) { // mode is in arguments[0] - we're using the named parameter // field is in arguments[1] - we're using the named parameter // value is in arguments[2] - we're using the named parameter // in this case, we aren't following the curry principles entirely // if we were we would pass the full paramater chain to the calling function // but we're using curry to insert a first param and allow the remaining // parameters to by dynamic. So, to make skuid think we didn't do anything // we need to strip back off our first param and pass the remaining // parameters to the original renderer var origArgs = Array.prototype.slice.call(arguments, 1); // invoke the original renderer originalRef[mode].apply(this, origArgs); $('a',field.element).attr("target", "_blank"); }; // our wrapper renderer that contains the logic for which renderer to actually invoke // this allows the specific renderers themselves to be single purposed var customRefRenderer = function(mode, field, value) { refRenderer.apply(this, arguments); }; // we need way within the renderer to know which mode we should use // we can't rely on field.mode because underneath, skuid directly invokes // READ from READONLY. However, since we have replaced the originals, we // end up in a recursive loop calling back in to READONLY on the original // because field.mode is READONLY. Sine we made some curry we'll add // a little custom renderer wrapper sauce to it and mmmmm, yummy! REFERENCE.read = curry(customRefRenderer, 'read'); REFERENCE.readonly = curry(customRefRenderer, 'readonly'); REFERENCE.edit = curry(customRefRenderer, 'edit'); })(skuid);<br>