221
221
* Remove the Loading.... spinner (if it exists).
223
223
function hide_temporary_spinner(temp_spinner) {
224
if( temp_spinner !== null ) {
224
if (temp_spinner !== undefined && temp_spinner !== null) {
225
225
temp_spinner.addClass('unseen');
318
* Connect the onchange event of the select menu to copy the selected value
321
* @param {Node} select_menu The select menu with suggested matches.
322
* @param {Node} text_input The input field to copy the selected match too.
324
namespace.connect_select_menu = function (select_menu, text_input) {
325
var copy_selected_value = function(e) {
326
text_input.value = select_menu.value;
328
Y.on('change', copy_selected_value, select_menu);
333
* Extend the lazr-js Picker.
335
var Picker = function() {
336
Picker.superclass.constructor.apply(this, arguments);
339
Y.extend(Picker, Y.lazr.Picker, {
340
// We want to render alt title slightly differently.
341
_renderTitleUI: function(data) {
342
var li_title = Y.Node.create(
343
'<span></span>').addClass(Y.lazr.Picker.C_RESULT_TITLE);
344
var title = this._text_or_link(
345
data.title, data.title_link, data.link_css);
346
li_title.appendChild(title);
347
if (data.alt_title) {
349
if (data.alt_title_link) {
350
alt_link =Y.Node.create('<a></a>')
351
.addClass(data.link_css)
352
.addClass('discreet');
353
alt_link.set('text', " Details...")
354
.set('href', data.alt_title_link);
355
Y.on('click', function(e) {
357
window.open(data.alt_title_link);
360
li_title.appendChild(' (');
361
li_title.appendChild(document.createTextNode(data.alt_title));
362
if (alt_link !== null)
363
li_title.appendChild(alt_link);
364
li_title.appendChild(')');
369
Picker.NAME = 'picker';
370
namespace.Picker = Picker;
317
373
* Creates a picker widget that has already been rendered and hidden.
364
var picker = new Y.lazr.Picker(new_config);
420
var picker = new Picker(new_config);
366
422
// We don't want the Y.lazr.Picker default save to fire since this hides
367
423
// the form. We want to do this ourselves after any validation has had a
485
541
}, "0.1", {"requires": [
486
"io", "dom", "dump", "lazr.picker", "lazr.activator", "json-parse",
542
"io", "dom", "dump", "event", "lazr.picker", "lazr.activator",
543
"json-parse", "lp.client"