# HG changeset patch # User Adrien Di Mascio # Date 1284364903 -7200 # Node ID 759cf097f5aadc71772e8ca28d409abb1883bac5 # Parent e03808843325c6455a9555a2349b1290a0c4b97b [javascript] get rid of tabs diff -r e03808843325 -r 759cf097f5aa web/data/cubicweb.ajax.box.js --- a/web/data/cubicweb.ajax.box.js Mon Sep 13 09:56:10 2010 +0200 +++ b/web/data/cubicweb.ajax.box.js Mon Sep 13 10:01:43 2010 +0200 @@ -11,71 +11,71 @@ var holderid = cw.utils.domid(boxid) + eid + 'Holder'; var value = $('#' + holderid + 'Input').val(); if (separator) { - value = $.map(value.split(separator), jQuery.trim); + value = $.map(value.split(separator), jQuery.trim); } var d = loadRemote('json', ajaxFuncArgs(fname, null, eid, value)); d.addCallback(function() { - $('#' + holderid).empty(); - var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid); - $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams); - if (msg) { - document.location.hash = '#header'; - updateMessage(msg); - } - }); + $('#' + holderid).empty(); + var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid); + $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams); + if (msg) { + document.location.hash = '#header'; + updateMessage(msg); + } + }); } function ajaxBoxRemoveLinkedEntity(boxid, eid, relatedeid, delfname, msg) { var d = loadRemote('json', ajaxFuncArgs(delfname, null, eid, relatedeid)); d.addCallback(function() { - var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid); - $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams); - if (msg) { - document.location.hash = '#header'; - updateMessage(msg); - } + var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid); + $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams); + if (msg) { + document.location.hash = '#header'; + updateMessage(msg); + } }); } function ajaxBoxShowSelector(boxid, eid, - unrelfname, - addfname, msg, - oklabel, cancellabel, - separator) { + unrelfname, + addfname, msg, + oklabel, cancellabel, + separator) { var holderid = cw.utils.domid(boxid) + eid + 'Holder'; var holder = $('#' + holderid); if (holder.children().length) { - holder.empty(); + holder.empty(); } else { - var inputid = holderid + 'Input'; - var deferred = loadRemote('json', ajaxFuncArgs(unrelfname, null, eid)); - deferred.addCallback(function (unrelated) { - var input = INPUT({'type': 'text', 'id': inputid, 'size': 20}); - holder.append(input).show(); - $input = $(input); - $input.keypress(function (event) { - if (event.keyCode == KEYS.KEY_ENTER) { - // XXX not very user friendly: we should test that the suggestions - // aren't visible anymore - ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg); - } - }); - var buttons = DIV({'class' : "sgformbuttons"}, - A({'href' : "javascript: noop();", - 'onclick' : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput', - boxid, eid, separator, addfname, msg)}, - oklabel), - ' / ', - A({'href' : "javascript: noop();", - 'onclick' : '$("#' + holderid + '").empty()'}, - cancellabel)); - holder.append(buttons); - $input.autocomplete(unrelated, { - multiple: separator, - max: 15 - }); - $input.focus(); - }); + var inputid = holderid + 'Input'; + var deferred = loadRemote('json', ajaxFuncArgs(unrelfname, null, eid)); + deferred.addCallback(function (unrelated) { + var input = INPUT({'type': 'text', 'id': inputid, 'size': 20}); + holder.append(input).show(); + $input = $(input); + $input.keypress(function (event) { + if (event.keyCode == KEYS.KEY_ENTER) { + // XXX not very user friendly: we should test that the suggestions + // aren't visible anymore + ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg); + } + }); + var buttons = DIV({'class' : "sgformbuttons"}, + A({'href' : "javascript: noop();", + 'onclick' : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput', + boxid, eid, separator, addfname, msg)}, + oklabel), + ' / ', + A({'href' : "javascript: noop();", + 'onclick' : '$("#' + holderid + '").empty()'}, + cancellabel)); + holder.append(buttons); + $input.autocomplete(unrelated, { + multiple: separator, + max: 15 + }); + $input.focus(); + }); } } diff -r e03808843325 -r 759cf097f5aa web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Mon Sep 13 09:56:10 2010 +0200 +++ b/web/data/cubicweb.ajax.js Mon Sep 13 10:01:43 2010 +0200 @@ -94,28 +94,28 @@ function _loadAjaxHtmlHead($node, $head, tag, srcattr) { var jqtagfilter = tag + '[' + srcattr + ']'; if (cw['loaded_'+srcattr] === undefined) { - cw['loaded_'+srcattr] = []; - var loaded = cw['loaded_'+srcattr]; - jQuery('head ' + jqtagfilter).each(function(i) { - loaded.push(this.getAttribute(srcattr)); - }); + cw['loaded_'+srcattr] = []; + var loaded = cw['loaded_'+srcattr]; + jQuery('head ' + jqtagfilter).each(function(i) { + loaded.push(this.getAttribute(srcattr)); + }); } else { - var loaded = cw['loaded_'+srcattr]; + var loaded = cw['loaded_'+srcattr]; } $node.find(tag).each(function(i) { - var url = this.getAttribute(srcattr); + var url = this.getAttribute(srcattr); if (url) { if (jQuery.inArray(url, loaded) == -1) { - // take care to