1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/864fdca5b06e/ Changeset: 864fdca5b06e User: carlfeberhard Date: 2014-12-08 20:18:12+00:00 Summary: Client build: factor dropDownSelect into filter control Affected #: 6 files diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 client/galaxy/scripts/jq-plugins/ui/filter-control.js --- a/client/galaxy/scripts/jq-plugins/ui/filter-control.js +++ b/client/galaxy/scripts/jq-plugins/ui/filter-control.js @@ -10,6 +10,61 @@ } }(function ($) { + //============================================================================== + /** + * Template function that produces a bootstrap dropdown to replace the + * vanilla HTML select input. Pass in an array of options and an initial selection: + * $( '.my-div' ).append( dropDownSelect( [ 'option1', 'option2' ], 'option2' ); + * + * When the user changes the selected option a 'change.dropdown-select' event will + * fire with both the jq event and the new selection text as arguments. + * + * Get the currently selected choice using: + * var userChoice = $( '.my-div .dropdown-select .dropdown-select-selected' ).text(); + * + */ + function dropDownSelect( options, selected ){ + // replacement for vanilla select element using bootstrap dropdowns instead + selected = selected || (( !_.isEmpty( options ) )?( options[0] ):( '' )); + var $select = $([ + '<div class="dropdown-select btn-group">', + '<button type="button" class="btn btn-default">', + '<span class="dropdown-select-selected">' + selected + '</span>', + '</button>', + '</div>' + ].join( '\n' )); + + // if there's only one option, do not style/create as buttons, dropdown - use simple span + // otherwise, a dropdown displaying the current selection + if( options && options.length > 1 ){ + $select.find( 'button' ) + .addClass( 'dropdown-toggle' ).attr( 'data-toggle', 'dropdown' ) + .append( ' <span class="caret"></span>' ); + $select.append([ + '<ul class="dropdown-menu" role="menu">', + _.map( options, function( option ){ + return [ + '<li><a href="javascript:void(0)">', option, '</a></li>' + ].join( '' ); + }).join( '\n' ), + '</ul>' + ].join( '\n' )); + } + + // trigger 'change.dropdown-select' when a new selection is made using the dropdown + function selectThis( event ){ + var $this = $( this ), + $select = $this.parents( '.dropdown-select' ), + newSelection = $this.text(); + $select.find( '.dropdown-select-selected' ).text( newSelection ); + $select.trigger( 'change.dropdown-select', newSelection ); + } + + $select.find( 'a' ).click( selectThis ); + return $select; + } + + //============================================================================== /** * Creates a three part bootstrap button group (key, op, value) meant to * allow the user control of filters (e.g. { key: 'name', op: 'contains', value: 'my_history' }) diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 client/galaxy/scripts/mvc/ui.js --- a/client/galaxy/scripts/mvc/ui.js +++ b/client/galaxy/scripts/mvc/ui.js @@ -930,200 +930,3 @@ } }); }()); - - -//============================================================================== -/** - * Template function that produces a bootstrap dropdown to replace the - * vanilla HTML select input. Pass in an array of options and an initial selection: - * $( '.my-div' ).append( dropDownSelect( [ 'option1', 'option2' ], 'option2' ); - * - * When the user changes the selected option a 'change.dropdown-select' event will - * fire with both the jq event and the new selection text as arguments. - * - * Get the currently selected choice using: - * var userChoice = $( '.my-div .dropdown-select .dropdown-select-selected' ).text(); - * - */ -function dropDownSelect( options, selected ){ - // replacement for vanilla select element using bootstrap dropdowns instead - selected = selected || (( !_.isEmpty( options ) )?( options[0] ):( '' )); - var $select = $([ - '<div class="dropdown-select btn-group">', - '<button type="button" class="btn btn-default">', - '<span class="dropdown-select-selected">' + selected + '</span>', - '</button>', - '</div>' - ].join( '\n' )); - - // if there's only one option, do not style/create as buttons, dropdown - use simple span - // otherwise, a dropdown displaying the current selection - if( options && options.length > 1 ){ - $select.find( 'button' ) - .addClass( 'dropdown-toggle' ).attr( 'data-toggle', 'dropdown' ) - .append( ' <span class="caret"></span>' ); - $select.append([ - '<ul class="dropdown-menu" role="menu">', - _.map( options, function( option ){ - return [ - '<li><a href="javascript:void(0)">', option, '</a></li>' - ].join( '' ); - }).join( '\n' ), - '</ul>' - ].join( '\n' )); - } - - // trigger 'change.dropdown-select' when a new selection is made using the dropdown - function selectThis( event ){ - var $this = $( this ), - $select = $this.parents( '.dropdown-select' ), - newSelection = $this.text(); - $select.find( '.dropdown-select-selected' ).text( newSelection ); - $select.trigger( 'change.dropdown-select', newSelection ); - } - - $select.find( 'a' ).click( selectThis ); - return $select; -} - - -//============================================================================== -(function(){ - /** - * Creates a three part bootstrap button group (key, op, value) meant to - * allow the user control of filters (e.g. { key: 'name', op: 'contains', value: 'my_history' }) - * - * Each field uses a dropDownSelect (from ui.js) to allow selection - * (with the 'value' field appearing as an input when set to do so). - * - * Any change or update in any of the fields will trigger a 'change.filter-control' - * event which will be passed an object containing those fields (as the example above). - * - * Pass in an array of possible filter objects to control what the user can select. - * Each filter object should have: - * key : generally the attribute name on which to filter something - * ops : an array of 1 or more filter operations (e.g. [ 'is', '<', 'contains', '!=' ]) - * values (optional) : an array of possible values for the filter (e.g. [ 'true', 'false' ]) - * @example: - * $( '.my-div' ).filterControl({ - * filters : [ - * { key: 'name', ops: [ 'is exactly', 'contains' ] } - * { key: 'deleted', ops: [ 'is' ], values: [ 'true', 'false' ] } - * ] - * }); - * // after initialization, you can prog. get the current value using: - * $( '.my-div' ).filterControl( 'val' ) - * - */ - function FilterControl( element, options ){ - return this.init( element, options ); - } - /** the data key that this object will be stored under in the DOM element */ - FilterControl.prototype.DATA_KEY = 'filter-control'; - - /** parses options, sets up instance vars, and does initial render */ - FilterControl.prototype.init = function _init( element, options ){ - options = options || { filters: [] }; - this.$element = $( element ).addClass( 'filter-control btn-group' ); - this.options = jQuery.extend( true, {}, this.defaults, options ); - - this.currFilter = this.options.filters[0]; - return this.render(); - }; - - /** render (or re-render) the controls on the element */ - FilterControl.prototype.render = function _render(){ - this.$element.empty() - .append([ this._renderKeySelect(), this._renderOpSelect(), this._renderValueInput() ]); - return this; - }; - - /** render the key dropDownSelect, bind a change event to it, and return it */ - FilterControl.prototype._renderKeySelect = function __renderKeySelect(){ - var filterControl = this; - var keys = this.options.filters.map( function( filter ){ - return filter.key; - }); - this.$keySelect = dropDownSelect( keys, this.currFilter.key ) - .addClass( 'filter-control-key' ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl.currFilter = _.findWhere( filterControl.options.filters, { key: selection }); - // when the filter/key changes, re-render the control entirely - filterControl.render()._triggerChange(); - }); - return this.$keySelect; - }; - - /** render the op dropDownSelect, bind a change event to it, and return it */ - FilterControl.prototype._renderOpSelect = function __renderOpSelect(){ - var filterControl = this, - ops = this.currFilter.ops; - //TODO: search for currOp in avail. ops: use that for selected if there; otherwise: first op - this.$opSelect = dropDownSelect( ops, ops[0] ) - .addClass( 'filter-control-op' ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl._triggerChange(); - }); - return this.$opSelect; - }; - - /** render the value control, bind a change event to it, and return it */ - FilterControl.prototype._renderValueInput = function __renderValueInput(){ - var filterControl = this; - // if a values attribute is prov. on the filter - make this a dropdown; otherwise, use an input - if( this.currFilter.values ){ - this.$valueSelect = dropDownSelect( this.currFilter.values, this.currFilter.values[0] ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl._triggerChange(); - }); - } else { - //TODO: allow setting a value type (mainly for which html5 input to use: range, number, etc.) - this.$valueSelect = $( '<input/>' ).addClass( 'form-control' ) - .on( 'change', function( event, value ){ - filterControl._triggerChange(); - }); - } - this.$valueSelect.addClass( 'filter-control-value' ); - return this.$valueSelect; - }; - - /** return the current state/setting for the filter as a three key object: key, op, value */ - FilterControl.prototype.val = function _val(){ - var key = this.$element.find( '.filter-control-key .dropdown-select-selected' ).text(), - op = this.$element.find( '.filter-control-op .dropdown-select-selected' ).text(), - // handle either a dropdown or plain input - $value = this.$element.find( '.filter-control-value' ), - value = ( $value.hasClass( 'dropdown-select' ) )?( $value.find( '.dropdown-select-selected' ).text() ) - :( $value.val() ); - return { key: key, op: op, value: value }; - }; - - // single point of change for change event - FilterControl.prototype._triggerChange = function __triggerChange(){ - this.$element.trigger( 'change.filter-control', this.val() ); - }; - - - // as jq plugin - jQuery.fn.extend({ - filterControl : function $filterControl( options ){ - var nonOptionsArgs = jQuery.makeArray( arguments ).slice( 1 ); - return this.map( function(){ - var $this = $( this ), - data = $this.data( FilterControl.prototype.DATA_KEY ); - - if( jQuery.type( options ) === 'object' ){ - data = new FilterControl( $this, options ); - $this.data( FilterControl.prototype.DATA_KEY, data ); - } - if( data && jQuery.type( options ) === 'string' ){ - var fn = data[ options ]; - if( jQuery.type( fn ) === 'function' ){ - return fn.apply( data, nonOptionsArgs ); - } - } - return this; - }); - } - }); -}()); diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 static/scripts/jq-plugins/ui/filter-control.js --- a/static/scripts/jq-plugins/ui/filter-control.js +++ b/static/scripts/jq-plugins/ui/filter-control.js @@ -10,6 +10,61 @@ } }(function ($) { + //============================================================================== + /** + * Template function that produces a bootstrap dropdown to replace the + * vanilla HTML select input. Pass in an array of options and an initial selection: + * $( '.my-div' ).append( dropDownSelect( [ 'option1', 'option2' ], 'option2' ); + * + * When the user changes the selected option a 'change.dropdown-select' event will + * fire with both the jq event and the new selection text as arguments. + * + * Get the currently selected choice using: + * var userChoice = $( '.my-div .dropdown-select .dropdown-select-selected' ).text(); + * + */ + function dropDownSelect( options, selected ){ + // replacement for vanilla select element using bootstrap dropdowns instead + selected = selected || (( !_.isEmpty( options ) )?( options[0] ):( '' )); + var $select = $([ + '<div class="dropdown-select btn-group">', + '<button type="button" class="btn btn-default">', + '<span class="dropdown-select-selected">' + selected + '</span>', + '</button>', + '</div>' + ].join( '\n' )); + + // if there's only one option, do not style/create as buttons, dropdown - use simple span + // otherwise, a dropdown displaying the current selection + if( options && options.length > 1 ){ + $select.find( 'button' ) + .addClass( 'dropdown-toggle' ).attr( 'data-toggle', 'dropdown' ) + .append( ' <span class="caret"></span>' ); + $select.append([ + '<ul class="dropdown-menu" role="menu">', + _.map( options, function( option ){ + return [ + '<li><a href="javascript:void(0)">', option, '</a></li>' + ].join( '' ); + }).join( '\n' ), + '</ul>' + ].join( '\n' )); + } + + // trigger 'change.dropdown-select' when a new selection is made using the dropdown + function selectThis( event ){ + var $this = $( this ), + $select = $this.parents( '.dropdown-select' ), + newSelection = $this.text(); + $select.find( '.dropdown-select-selected' ).text( newSelection ); + $select.trigger( 'change.dropdown-select', newSelection ); + } + + $select.find( 'a' ).click( selectThis ); + return $select; + } + + //============================================================================== /** * Creates a three part bootstrap button group (key, op, value) meant to * allow the user control of filters (e.g. { key: 'name', op: 'contains', value: 'my_history' }) diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 static/scripts/mvc/ui.js --- a/static/scripts/mvc/ui.js +++ b/static/scripts/mvc/ui.js @@ -930,200 +930,3 @@ } }); }()); - - -//============================================================================== -/** - * Template function that produces a bootstrap dropdown to replace the - * vanilla HTML select input. Pass in an array of options and an initial selection: - * $( '.my-div' ).append( dropDownSelect( [ 'option1', 'option2' ], 'option2' ); - * - * When the user changes the selected option a 'change.dropdown-select' event will - * fire with both the jq event and the new selection text as arguments. - * - * Get the currently selected choice using: - * var userChoice = $( '.my-div .dropdown-select .dropdown-select-selected' ).text(); - * - */ -function dropDownSelect( options, selected ){ - // replacement for vanilla select element using bootstrap dropdowns instead - selected = selected || (( !_.isEmpty( options ) )?( options[0] ):( '' )); - var $select = $([ - '<div class="dropdown-select btn-group">', - '<button type="button" class="btn btn-default">', - '<span class="dropdown-select-selected">' + selected + '</span>', - '</button>', - '</div>' - ].join( '\n' )); - - // if there's only one option, do not style/create as buttons, dropdown - use simple span - // otherwise, a dropdown displaying the current selection - if( options && options.length > 1 ){ - $select.find( 'button' ) - .addClass( 'dropdown-toggle' ).attr( 'data-toggle', 'dropdown' ) - .append( ' <span class="caret"></span>' ); - $select.append([ - '<ul class="dropdown-menu" role="menu">', - _.map( options, function( option ){ - return [ - '<li><a href="javascript:void(0)">', option, '</a></li>' - ].join( '' ); - }).join( '\n' ), - '</ul>' - ].join( '\n' )); - } - - // trigger 'change.dropdown-select' when a new selection is made using the dropdown - function selectThis( event ){ - var $this = $( this ), - $select = $this.parents( '.dropdown-select' ), - newSelection = $this.text(); - $select.find( '.dropdown-select-selected' ).text( newSelection ); - $select.trigger( 'change.dropdown-select', newSelection ); - } - - $select.find( 'a' ).click( selectThis ); - return $select; -} - - -//============================================================================== -(function(){ - /** - * Creates a three part bootstrap button group (key, op, value) meant to - * allow the user control of filters (e.g. { key: 'name', op: 'contains', value: 'my_history' }) - * - * Each field uses a dropDownSelect (from ui.js) to allow selection - * (with the 'value' field appearing as an input when set to do so). - * - * Any change or update in any of the fields will trigger a 'change.filter-control' - * event which will be passed an object containing those fields (as the example above). - * - * Pass in an array of possible filter objects to control what the user can select. - * Each filter object should have: - * key : generally the attribute name on which to filter something - * ops : an array of 1 or more filter operations (e.g. [ 'is', '<', 'contains', '!=' ]) - * values (optional) : an array of possible values for the filter (e.g. [ 'true', 'false' ]) - * @example: - * $( '.my-div' ).filterControl({ - * filters : [ - * { key: 'name', ops: [ 'is exactly', 'contains' ] } - * { key: 'deleted', ops: [ 'is' ], values: [ 'true', 'false' ] } - * ] - * }); - * // after initialization, you can prog. get the current value using: - * $( '.my-div' ).filterControl( 'val' ) - * - */ - function FilterControl( element, options ){ - return this.init( element, options ); - } - /** the data key that this object will be stored under in the DOM element */ - FilterControl.prototype.DATA_KEY = 'filter-control'; - - /** parses options, sets up instance vars, and does initial render */ - FilterControl.prototype.init = function _init( element, options ){ - options = options || { filters: [] }; - this.$element = $( element ).addClass( 'filter-control btn-group' ); - this.options = jQuery.extend( true, {}, this.defaults, options ); - - this.currFilter = this.options.filters[0]; - return this.render(); - }; - - /** render (or re-render) the controls on the element */ - FilterControl.prototype.render = function _render(){ - this.$element.empty() - .append([ this._renderKeySelect(), this._renderOpSelect(), this._renderValueInput() ]); - return this; - }; - - /** render the key dropDownSelect, bind a change event to it, and return it */ - FilterControl.prototype._renderKeySelect = function __renderKeySelect(){ - var filterControl = this; - var keys = this.options.filters.map( function( filter ){ - return filter.key; - }); - this.$keySelect = dropDownSelect( keys, this.currFilter.key ) - .addClass( 'filter-control-key' ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl.currFilter = _.findWhere( filterControl.options.filters, { key: selection }); - // when the filter/key changes, re-render the control entirely - filterControl.render()._triggerChange(); - }); - return this.$keySelect; - }; - - /** render the op dropDownSelect, bind a change event to it, and return it */ - FilterControl.prototype._renderOpSelect = function __renderOpSelect(){ - var filterControl = this, - ops = this.currFilter.ops; - //TODO: search for currOp in avail. ops: use that for selected if there; otherwise: first op - this.$opSelect = dropDownSelect( ops, ops[0] ) - .addClass( 'filter-control-op' ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl._triggerChange(); - }); - return this.$opSelect; - }; - - /** render the value control, bind a change event to it, and return it */ - FilterControl.prototype._renderValueInput = function __renderValueInput(){ - var filterControl = this; - // if a values attribute is prov. on the filter - make this a dropdown; otherwise, use an input - if( this.currFilter.values ){ - this.$valueSelect = dropDownSelect( this.currFilter.values, this.currFilter.values[0] ) - .on( 'change.dropdown-select', function( event, selection ){ - filterControl._triggerChange(); - }); - } else { - //TODO: allow setting a value type (mainly for which html5 input to use: range, number, etc.) - this.$valueSelect = $( '<input/>' ).addClass( 'form-control' ) - .on( 'change', function( event, value ){ - filterControl._triggerChange(); - }); - } - this.$valueSelect.addClass( 'filter-control-value' ); - return this.$valueSelect; - }; - - /** return the current state/setting for the filter as a three key object: key, op, value */ - FilterControl.prototype.val = function _val(){ - var key = this.$element.find( '.filter-control-key .dropdown-select-selected' ).text(), - op = this.$element.find( '.filter-control-op .dropdown-select-selected' ).text(), - // handle either a dropdown or plain input - $value = this.$element.find( '.filter-control-value' ), - value = ( $value.hasClass( 'dropdown-select' ) )?( $value.find( '.dropdown-select-selected' ).text() ) - :( $value.val() ); - return { key: key, op: op, value: value }; - }; - - // single point of change for change event - FilterControl.prototype._triggerChange = function __triggerChange(){ - this.$element.trigger( 'change.filter-control', this.val() ); - }; - - - // as jq plugin - jQuery.fn.extend({ - filterControl : function $filterControl( options ){ - var nonOptionsArgs = jQuery.makeArray( arguments ).slice( 1 ); - return this.map( function(){ - var $this = $( this ), - data = $this.data( FilterControl.prototype.DATA_KEY ); - - if( jQuery.type( options ) === 'object' ){ - data = new FilterControl( $this, options ); - $this.data( FilterControl.prototype.DATA_KEY, data ); - } - if( data && jQuery.type( options ) === 'string' ){ - var fn = data[ options ]; - if( jQuery.type( fn ) === 'function' ){ - return fn.apply( data, nonOptionsArgs ); - } - } - return this; - }); - } - }); -}()); diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 static/scripts/packed/jq-plugins/ui/filter-control.js --- a/static/scripts/packed/jq-plugins/ui/filter-control.js +++ b/static/scripts/packed/jq-plugins/ui/filter-control.js @@ -1,1 +1,1 @@ -(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(c){function f(l,k){return this.init(l,k)}f.prototype.DATA_KEY="filter-control";f.prototype.init=function i(l,k){k=k||{filters:[]};this.$element=c(l).addClass("filter-control btn-group");this.options=jQuery.extend(true,{},this.defaults,k);this.currFilter=this.options.filters[0];return this.render()};f.prototype.render=function e(){this.$element.empty().append([this._renderKeySelect(),this._renderOpSelect(),this._renderValueInput()]);return this};f.prototype._renderKeySelect=function a(){var k=this;var l=this.options.filters.map(function(m){return m.key});this.$keySelect=dropDownSelect(l,this.currFilter.key).addClass("filter-control-key").on("change.dropdown-select",function(n,m){k.currFilter=_.findWhere(k.options.filters,{key:m});k.render()._triggerChange()});return this.$keySelect};f.prototype._renderOpSelect=function j(){var k=this,l=this.currFilter.ops;this.$opSelect=dropDownSelect(l,l[0]).addClass("filter-control-op").on("change.dropdown-select",function(n,m){k._triggerChange()});return this.$opSelect};f.prototype._renderValueInput=function d(){var k=this;if(this.currFilter.values){this.$valueSelect=dropDownSelect(this.currFilter.values,this.currFilter.values[0]).on("change.dropdown-select",function(m,l){k._triggerChange()})}else{this.$valueSelect=c("<input/>").addClass("form-control").on("change",function(l,m){k._triggerChange()})}this.$valueSelect.addClass("filter-control-value");return this.$valueSelect};f.prototype.val=function b(){var l=this.$element.find(".filter-control-key .dropdown-select-selected").text(),n=this.$element.find(".filter-control-op .dropdown-select-selected").text(),k=this.$element.find(".filter-control-value"),m=(k.hasClass("dropdown-select"))?(k.find(".dropdown-select-selected").text()):(k.val());return{key:l,op:n,value:m}};f.prototype._triggerChange=function h(){this.$element.trigger("change.filter-control",this.val())};jQuery.fn.extend({filterControl:function g(l){var k=jQuery.makeArray(arguments).slice(1);return this.map(function(){var o=c(this),n=o.data(f.prototype.DATA_KEY);if(jQuery.type(l)==="object"){n=new f(o,l);o.data(f.prototype.DATA_KEY,n)}if(n&&jQuery.type(l)==="string"){var m=n[l];if(jQuery.type(m)==="function"){return m.apply(n,k)}}return this})}})})); \ No newline at end of file +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(c){function j(m,n){n=n||((!_.isEmpty(m))?(m[0]):(""));var l=c(['<div class="dropdown-select btn-group">','<button type="button" class="btn btn-default">','<span class="dropdown-select-selected">'+n+"</span>","</button>","</div>"].join("\n"));if(m&&m.length>1){l.find("button").addClass("dropdown-toggle").attr("data-toggle","dropdown").append(' <span class="caret"></span>');l.append(['<ul class="dropdown-menu" role="menu">',_.map(m,function(p){return['<li><a href="javascript:void(0)">',p,"</a></li>"].join("")}).join("\n"),"</ul>"].join("\n"))}function o(r){var s=c(this),q=s.parents(".dropdown-select"),p=s.text();q.find(".dropdown-select-selected").text(p);q.trigger("change.dropdown-select",p)}l.find("a").click(o);return l}function f(m,l){return this.init(m,l)}f.prototype.DATA_KEY="filter-control";f.prototype.init=function i(m,l){l=l||{filters:[]};this.$element=c(m).addClass("filter-control btn-group");this.options=jQuery.extend(true,{},this.defaults,l);this.currFilter=this.options.filters[0];return this.render()};f.prototype.render=function e(){this.$element.empty().append([this._renderKeySelect(),this._renderOpSelect(),this._renderValueInput()]);return this};f.prototype._renderKeySelect=function a(){var l=this;var m=this.options.filters.map(function(n){return n.key});this.$keySelect=j(m,this.currFilter.key).addClass("filter-control-key").on("change.dropdown-select",function(o,n){l.currFilter=_.findWhere(l.options.filters,{key:n});l.render()._triggerChange()});return this.$keySelect};f.prototype._renderOpSelect=function k(){var l=this,m=this.currFilter.ops;this.$opSelect=j(m,m[0]).addClass("filter-control-op").on("change.dropdown-select",function(o,n){l._triggerChange()});return this.$opSelect};f.prototype._renderValueInput=function d(){var l=this;if(this.currFilter.values){this.$valueSelect=j(this.currFilter.values,this.currFilter.values[0]).on("change.dropdown-select",function(n,m){l._triggerChange()})}else{this.$valueSelect=c("<input/>").addClass("form-control").on("change",function(m,n){l._triggerChange()})}this.$valueSelect.addClass("filter-control-value");return this.$valueSelect};f.prototype.val=function b(){var m=this.$element.find(".filter-control-key .dropdown-select-selected").text(),o=this.$element.find(".filter-control-op .dropdown-select-selected").text(),l=this.$element.find(".filter-control-value"),n=(l.hasClass("dropdown-select"))?(l.find(".dropdown-select-selected").text()):(l.val());return{key:m,op:o,value:n}};f.prototype._triggerChange=function h(){this.$element.trigger("change.filter-control",this.val())};jQuery.fn.extend({filterControl:function g(m){var l=jQuery.makeArray(arguments).slice(1);return this.map(function(){var p=c(this),o=p.data(f.prototype.DATA_KEY);if(jQuery.type(m)==="object"){o=new f(p,m);p.data(f.prototype.DATA_KEY,o)}if(o&&jQuery.type(m)==="string"){var n=o[m];if(jQuery.type(n)==="function"){return n.apply(o,l)}}return this})}})})); \ No newline at end of file diff -r a667776c4a1bc13cf1645c9ddd5af8892cc32b28 -r 864fdca5b06e6f15040298a316746448d09cdb40 static/scripts/packed/mvc/ui.js --- a/static/scripts/packed/mvc/ui.js +++ b/static/scripts/packed/mvc/ui.js @@ -1,1 +1,1 @@ -var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:true,id:null,href:null,target:null,enabled:true,visible:true,tooltip_config:{}}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=this.template(this.model.toJSON());a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(_.isFunction(this.model.get("on_click"))){this.model.get("on_click")(a);return false}return true},template:function(b){var a='title="'+b.title+'" class="icon-button';if(b.is_menu_button){a+=" menu-button"}a+=" "+b.icon_class;if(!b.enabled){a+="_disabled"}a+='"';if(b.id){a+=' id="'+b.id+'"'}a+=' href="'+b.href+'"';if(b.target){a+=' target="'+b.target+'"'}if(!b.visible){a+=' style="display: none;"'}if(b.enabled){a="<a "+a+"/>"}else{a="<span "+a+"/>"}return $(a)}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(d){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",d.attributes.title).addClass("icon-button menu-button").addClass(d.attributes.icon_class).appendTo(a.$el).click(d.attributes.on_click);if(d.attributes.tooltip_config){b.tooltip(d.attributes.tooltip_config)}var c=d.get("options");if(c){make_popupmenu(b,c)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var PopupMenu=Backbone.View.extend({initialize:function(b,a){this.$button=b;if(!this.$button.size()){this.$button=$("<div/>")}this.options=a||[];var c=this;this.$button.click(function(d){$(".popmenu-wrapper").remove();c._renderAndShow(d);return false})},_renderAndShow:function(a){this.render();this.$el.appendTo("body").css(this._getShownPosition(a)).show();this._setUpCloseBehavior()},render:function(){this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options));if(this.options.length){var a=this;this.$el.find("li").each(function(c,b){var d=a.options[c];if(d.func){$(this).children("a.popupmenu-option").click(function(e){d.func.call(a,e,d)})}})}return this},template:function(b,a){return['<ul id="',b,'-menu" class="dropdown-menu">',this._templateOptions(a),"</ul>"].join("")},_templateOptions:function(a){if(!a.length){return"<li>(no options)</li>"}return _.map(a,function(d){if(d.divider){return'<li class="divider"></li>'}else{if(d.header){return['<li class="head"><a href="javascript:void(0);">',d.html,"</a></li>"].join("")}}var c=d.href||"javascript:void(0);",e=(d.target)?(' target="'+d.target+'"'):(""),b=(d.checked)?('<span class="fa fa-check"></span>'):("");return['<li><a class="popupmenu-option" href="',c,'"',e,">",b,d.html,"</a></li>"].join("")}).join("")},_getShownPosition:function(b){var c=this.$el.width();var a=b.pageX-c/2;a=Math.min(a,$(document).scrollLeft()+$(window).width()-c-5);a=Math.max(a,$(document).scrollLeft()+5);return{top:b.pageY,left:a}},_setUpCloseBehavior:function(){var c=this;function a(e){$(document).off("click.close_popup");if(window.parent!==window){try{$(window.parent.document).off("click.close_popup")}catch(d){}}else{try{$("iframe#galaxy_main").contents().off("click.close_popup")}catch(d){}}c.remove()}$("html").one("click.close_popup",a);if(window.parent!==window){try{$(window.parent.document).find("html").one("click.close_popup",a)}catch(b){}}else{try{$("iframe#galaxy_main").contents().one("click.close_popup",a)}catch(b){}}},addItem:function(b,a){a=(a>=0)?a:this.options.length;this.options.splice(a,0,b);return this},removeItem:function(a){if(a>=0){this.options.splice(a,1)}return this},findIndexByHtml:function(b){for(var a=0;a<this.options.length;a++){if(_.has(this.options[a],"html")&&(this.options[a].html===b)){return a}}return null},findItemByHtml:function(a){return this.options[(this.findIndexByHtml(a))]},toString:function(){return"PopupMenu"}});PopupMenu.create=function _create(b,a){return new PopupMenu(b,a)};PopupMenu.make_popupmenu=function(b,c){var a=[];_.each(c,function(f,d){var e={html:d};if(f===null){e.header=true}else{if(jQuery.type(f)==="function"){e.func=f}}a.push(e)});return new PopupMenu($(b),a)};PopupMenu.convertLinksToOptions=function(c,a){c=$(c);a=a||"a";var b=[];c.find(a).each(function(g,e){var f={},d=$(g);f.html=d.text();if(d.attr("href")){var j=d.attr("href"),k=d.attr("target"),h=d.attr("confirm");f.func=function(){if((h)&&(!confirm(h))){return}switch(k){case"_parent":window.parent.location=j;break;case"_top":window.top.location=j;break;default:window.location=j}}}b.push(f)});return b};PopupMenu.fromExistingDom=function(d,c,a){d=$(d);c=$(c);var b=PopupMenu.convertLinksToOptions(c,a);c.remove();return new PopupMenu(d,b)};PopupMenu.make_popup_menus=function(c,b,d){c=c||document;b=b||"div[popupmenu]";d=d||function(e,f){return"#"+e.attr("popupmenu")};var a=[];$(c).find(b).each(function(){var e=$(this),f=$(c).find(d(e,c));a.push(PopupMenu.fromDom(f,e));f.addClass("popup")});return a};var faIconButton=function(a){a=a||{};a.tooltipConfig=a.tooltipConfig||{placement:"bottom"};a.classes=["icon-btn"].concat(a.classes||[]);if(a.disabled){a.classes.push("disabled")}var b=['<a class="',a.classes.join(" "),'"',((a.title)?(' title="'+a.title+'"'):("")),((!a.disabled&&a.target)?(' target="'+a.target+'"'):("")),' href="',((!a.disabled&&a.href)?(a.href):("javascript:void(0);")),'">','<span class="fa ',a.faIcon,'"></span>',"</a>"].join("");var c=$(b).tooltip(a.tooltipConfig);if(_.isFunction(a.onclick)){c.click(a.onclick)}return c};function LoadingIndicator(a,c){var b=this;c=jQuery.extend({cover:false},c||{});function d(){var e=['<div class="loading-indicator">','<div class="loading-indicator-text">','<span class="fa fa-spinner fa-spin fa-lg"></span>','<span class="loading-indicator-message">loading...</span>',"</div>","</div>"].join("\n");var g=$(e).hide().css(c.css||{position:"fixed"}),f=g.children(".loading-indicator-text");if(c.cover){g.css({"z-index":2,top:a.css("top"),bottom:a.css("bottom"),left:a.css("left"),right:a.css("right"),opacity:0.5,"background-color":"white","text-align":"center"});f=g.children(".loading-indicator-text").css({"margin-top":"20px"})}else{f=g.children(".loading-indicator-text").css({margin:"12px 0px 0px 10px",opacity:"0.85",color:"grey"});f.children(".loading-indicator-message").css({margin:"0px 8px 0px 0px","font-style":"italic"})}return g}b.show=function(f,e,g){f=f||"loading...";e=e||"fast";a.parent().find(".loading-indicator").remove();b.$indicator=d().insertBefore(a);b.message(f);b.$indicator.fadeIn(e,g);return b};b.message=function(e){b.$indicator.find("i").text(e)};b.hide=function(e,f){e=e||"fast";if(b.$indicator&&b.$indicator.size()){b.$indicator.fadeOut(e,function(){b.$indicator.remove();if(f){f()}})}else{if(f){f()}}return b};return b}(function(){var b=window._l||function(d){return d};function a(k,q){var e=27,n=13,d=$(k),f=true,h={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(r){},minSearchLen:0,escWillClear:true,oninit:function(){}};function j(r){var s=$(this).parent().children("input");s.focus().val("").trigger("clear:searchInput");q.onclear()}function p(s,r){$(this).trigger("search:searchInput",r);if(typeof q.onfirstsearch==="function"&&f){f=false;q.onfirstsearch(r)}else{q.onsearch(r)}}function g(){return['<input type="text" name="',q.name,'" placeholder="',q.placeholder,'" ','class="search-query ',q.classes,'" ',"/>"].join("")}function m(){return $(g()).focus(function(r){$(this).select()}).keyup(function(s){s.preventDefault();s.stopPropagation();if(!$(this).val()){$(this).blur()}if(s.which===e&&q.escWillClear){j.call(this,s)}else{var r=$(this).val();if((s.which===n)||(q.minSearchLen&&r.length>=q.minSearchLen)){p.call(this,s,r)}else{if(!r.length){j.call(this,s)}}}}).on("change",function(r){p.call(this,r,$(this).val())}).val(q.initialVal)}function l(){return $(['<span class="search-clear fa fa-times-circle" ','title="',b("clear search (esc)"),'"></span>'].join("")).tooltip({placement:"bottom"}).click(function(r){j.call(this,r)})}function o(){return $(['<span class="search-loading fa fa-spinner fa-spin" ','title="',b("loading..."),'"></span>'].join("")).hide().tooltip({placement:"bottom"})}function i(){d.find(".search-loading").toggle();d.find(".search-clear").toggle()}if(jQuery.type(q)==="string"){if(q==="toggle-loading"){i()}return d}if(jQuery.type(q)==="object"){q=jQuery.extend(true,{},h,q)}return d.addClass("search-input").prepend([m(),l(),o()])}jQuery.fn.extend({searchInput:function c(d){return this.each(function(){return a(this,d)})}})}());(function(){function c(o,n){this.currModeIndex=0;return this._init(o,n)}c.prototype.DATA_KEY="mode-button";c.prototype.defaults={switchModesOnClick:true};c.prototype._init=function j(o,n){n=n||{};this.$element=$(o);this.options=jQuery.extend(true,{},this.defaults,n);if(!n.modes){throw new Error('ModeButton requires a "modes" array')}var q=this;this.$element.click(function p(r){q.callModeFn();if(q.options.switchModesOnClick){q._incModeIndex()}$(this).html(q.options.modes[q.currModeIndex].html)});return this.reset()};c.prototype._incModeIndex=function l(){this.currModeIndex+=1;if(this.currModeIndex>=this.options.modes.length){this.currModeIndex=0}return this};c.prototype._getModeIndex=function f(n){for(var o=0;o<this.options.modes.length;o+=1){if(this.options.modes[o].mode===n){return o}}throw new Error("mode not found: "+n)};c.prototype._setModeByIndex=function m(n){var o=this.options.modes[n];if(!o){throw new Error("mode index not found: "+n)}this.currModeIndex=n;if(o.html){this.$element.html(o.html)}return this};c.prototype.currentMode=function d(){return this.options.modes[this.currModeIndex]};c.prototype.current=function i(){return this.currentMode().mode};c.prototype.getMode=function g(n){if(!n){return this.currentMode()}return this.options.modes[(this._getModeIndex(n))]};c.prototype.hasMode=function b(n){try{return !!this.getMode(n)}catch(o){}return false};c.prototype.setMode=function a(n){return this._setModeByIndex(this._getModeIndex(n))};c.prototype.reset=function h(){this.currModeIndex=0;if(this.options.initialMode){this.currModeIndex=this._getModeIndex(this.options.initialMode)}return this._setModeByIndex(this.currModeIndex)};c.prototype.callModeFn=function e(n){var o=this.getMode(n).onclick;if(o&&jQuery.type(o==="function")){return o.call(this.$element.get(0))}return undefined};jQuery.fn.extend({modeButton:function k(n){if(!this.size()){return this}if(jQuery.type(n)==="object"){return this.map(function(){var r=$(this);r.data("mode-button",new c(r,n));return this})}var p=$(this[0]),o=p.data("mode-button");if(!o){throw new Error("modeButton needs an options object or string name of a function")}if(o&&jQuery.type(n)==="string"){var q=n;if(o&&jQuery.type(o[q])==="function"){return o[q].apply(o,jQuery.makeArray(arguments).slice(1))}}return o}})}());function dropDownSelect(b,c){c=c||((!_.isEmpty(b))?(b[0]):(""));var a=$(['<div class="dropdown-select btn-group">','<button type="button" class="btn btn-default">','<span class="dropdown-select-selected">'+c+"</span>","</button>","</div>"].join("\n"));if(b&&b.length>1){a.find("button").addClass("dropdown-toggle").attr("data-toggle","dropdown").append(' <span class="caret"></span>');a.append(['<ul class="dropdown-menu" role="menu">',_.map(b,function(e){return['<li><a href="javascript:void(0)">',e,"</a></li>"].join("")}).join("\n"),"</ul>"].join("\n"))}function d(g){var h=$(this),f=h.parents(".dropdown-select"),e=h.text();f.find(".dropdown-select-selected").text(e);f.trigger("change.dropdown-select",e)}a.find("a").click(d);return a}(function(){function e(k,j){return this.init(k,j)}e.prototype.DATA_KEY="filter-control";e.prototype.init=function g(k,j){j=j||{filters:[]};this.$element=$(k).addClass("filter-control btn-group");this.options=jQuery.extend(true,{},this.defaults,j);this.currFilter=this.options.filters[0];return this.render()};e.prototype.render=function d(){this.$element.empty().append([this._renderKeySelect(),this._renderOpSelect(),this._renderValueInput()]);return this};e.prototype._renderKeySelect=function a(){var j=this;var k=this.options.filters.map(function(l){return l.key});this.$keySelect=dropDownSelect(k,this.currFilter.key).addClass("filter-control-key").on("change.dropdown-select",function(m,l){j.currFilter=_.findWhere(j.options.filters,{key:l});j.render()._triggerChange()});return this.$keySelect};e.prototype._renderOpSelect=function i(){var j=this,k=this.currFilter.ops;this.$opSelect=dropDownSelect(k,k[0]).addClass("filter-control-op").on("change.dropdown-select",function(m,l){j._triggerChange()});return this.$opSelect};e.prototype._renderValueInput=function c(){var j=this;if(this.currFilter.values){this.$valueSelect=dropDownSelect(this.currFilter.values,this.currFilter.values[0]).on("change.dropdown-select",function(l,k){j._triggerChange()})}else{this.$valueSelect=$("<input/>").addClass("form-control").on("change",function(k,l){j._triggerChange()})}this.$valueSelect.addClass("filter-control-value");return this.$valueSelect};e.prototype.val=function b(){var k=this.$element.find(".filter-control-key .dropdown-select-selected").text(),m=this.$element.find(".filter-control-op .dropdown-select-selected").text(),j=this.$element.find(".filter-control-value"),l=(j.hasClass("dropdown-select"))?(j.find(".dropdown-select-selected").text()):(j.val());return{key:k,op:m,value:l}};e.prototype._triggerChange=function h(){this.$element.trigger("change.filter-control",this.val())};jQuery.fn.extend({filterControl:function f(k){var j=jQuery.makeArray(arguments).slice(1);return this.map(function(){var n=$(this),m=n.data(e.prototype.DATA_KEY);if(jQuery.type(k)==="object"){m=new e(n,k);n.data(e.prototype.DATA_KEY,m)}if(m&&jQuery.type(k)==="string"){var l=m[k];if(jQuery.type(l)==="function"){return l.apply(m,j)}}return this})}})}()); \ No newline at end of file +var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:true,id:null,href:null,target:null,enabled:true,visible:true,tooltip_config:{}}});var IconButtonView=Backbone.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var a=this.template(this.model.toJSON());a.tooltip(this.model.get("tooltip_config"));this.$el.replaceWith(a);this.setElement(a);return this},events:{click:"click"},click:function(a){if(_.isFunction(this.model.get("on_click"))){this.model.get("on_click")(a);return false}return true},template:function(b){var a='title="'+b.title+'" class="icon-button';if(b.is_menu_button){a+=" menu-button"}a+=" "+b.icon_class;if(!b.enabled){a+="_disabled"}a+='"';if(b.id){a+=' id="'+b.id+'"'}a+=' href="'+b.href+'"';if(b.target){a+=' target="'+b.target+'"'}if(!b.visible){a+=' style="display: none;"'}if(b.enabled){a="<a "+a+"/>"}else{a="<span "+a+"/>"}return $(a)}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(d){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",d.attributes.title).addClass("icon-button menu-button").addClass(d.attributes.icon_class).appendTo(a.$el).click(d.attributes.on_click);if(d.attributes.tooltip_config){b.tooltip(d.attributes.tooltip_config)}var c=d.get("options");if(c){make_popupmenu(b,c)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var PopupMenu=Backbone.View.extend({initialize:function(b,a){this.$button=b;if(!this.$button.size()){this.$button=$("<div/>")}this.options=a||[];var c=this;this.$button.click(function(d){$(".popmenu-wrapper").remove();c._renderAndShow(d);return false})},_renderAndShow:function(a){this.render();this.$el.appendTo("body").css(this._getShownPosition(a)).show();this._setUpCloseBehavior()},render:function(){this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options));if(this.options.length){var a=this;this.$el.find("li").each(function(c,b){var d=a.options[c];if(d.func){$(this).children("a.popupmenu-option").click(function(e){d.func.call(a,e,d)})}})}return this},template:function(b,a){return['<ul id="',b,'-menu" class="dropdown-menu">',this._templateOptions(a),"</ul>"].join("")},_templateOptions:function(a){if(!a.length){return"<li>(no options)</li>"}return _.map(a,function(d){if(d.divider){return'<li class="divider"></li>'}else{if(d.header){return['<li class="head"><a href="javascript:void(0);">',d.html,"</a></li>"].join("")}}var c=d.href||"javascript:void(0);",e=(d.target)?(' target="'+d.target+'"'):(""),b=(d.checked)?('<span class="fa fa-check"></span>'):("");return['<li><a class="popupmenu-option" href="',c,'"',e,">",b,d.html,"</a></li>"].join("")}).join("")},_getShownPosition:function(b){var c=this.$el.width();var a=b.pageX-c/2;a=Math.min(a,$(document).scrollLeft()+$(window).width()-c-5);a=Math.max(a,$(document).scrollLeft()+5);return{top:b.pageY,left:a}},_setUpCloseBehavior:function(){var c=this;function a(e){$(document).off("click.close_popup");if(window.parent!==window){try{$(window.parent.document).off("click.close_popup")}catch(d){}}else{try{$("iframe#galaxy_main").contents().off("click.close_popup")}catch(d){}}c.remove()}$("html").one("click.close_popup",a);if(window.parent!==window){try{$(window.parent.document).find("html").one("click.close_popup",a)}catch(b){}}else{try{$("iframe#galaxy_main").contents().one("click.close_popup",a)}catch(b){}}},addItem:function(b,a){a=(a>=0)?a:this.options.length;this.options.splice(a,0,b);return this},removeItem:function(a){if(a>=0){this.options.splice(a,1)}return this},findIndexByHtml:function(b){for(var a=0;a<this.options.length;a++){if(_.has(this.options[a],"html")&&(this.options[a].html===b)){return a}}return null},findItemByHtml:function(a){return this.options[(this.findIndexByHtml(a))]},toString:function(){return"PopupMenu"}});PopupMenu.create=function _create(b,a){return new PopupMenu(b,a)};PopupMenu.make_popupmenu=function(b,c){var a=[];_.each(c,function(f,d){var e={html:d};if(f===null){e.header=true}else{if(jQuery.type(f)==="function"){e.func=f}}a.push(e)});return new PopupMenu($(b),a)};PopupMenu.convertLinksToOptions=function(c,a){c=$(c);a=a||"a";var b=[];c.find(a).each(function(g,e){var f={},d=$(g);f.html=d.text();if(d.attr("href")){var j=d.attr("href"),k=d.attr("target"),h=d.attr("confirm");f.func=function(){if((h)&&(!confirm(h))){return}switch(k){case"_parent":window.parent.location=j;break;case"_top":window.top.location=j;break;default:window.location=j}}}b.push(f)});return b};PopupMenu.fromExistingDom=function(d,c,a){d=$(d);c=$(c);var b=PopupMenu.convertLinksToOptions(c,a);c.remove();return new PopupMenu(d,b)};PopupMenu.make_popup_menus=function(c,b,d){c=c||document;b=b||"div[popupmenu]";d=d||function(e,f){return"#"+e.attr("popupmenu")};var a=[];$(c).find(b).each(function(){var e=$(this),f=$(c).find(d(e,c));a.push(PopupMenu.fromDom(f,e));f.addClass("popup")});return a};var faIconButton=function(a){a=a||{};a.tooltipConfig=a.tooltipConfig||{placement:"bottom"};a.classes=["icon-btn"].concat(a.classes||[]);if(a.disabled){a.classes.push("disabled")}var b=['<a class="',a.classes.join(" "),'"',((a.title)?(' title="'+a.title+'"'):("")),((!a.disabled&&a.target)?(' target="'+a.target+'"'):("")),' href="',((!a.disabled&&a.href)?(a.href):("javascript:void(0);")),'">','<span class="fa ',a.faIcon,'"></span>',"</a>"].join("");var c=$(b).tooltip(a.tooltipConfig);if(_.isFunction(a.onclick)){c.click(a.onclick)}return c};function LoadingIndicator(a,c){var b=this;c=jQuery.extend({cover:false},c||{});function d(){var e=['<div class="loading-indicator">','<div class="loading-indicator-text">','<span class="fa fa-spinner fa-spin fa-lg"></span>','<span class="loading-indicator-message">loading...</span>',"</div>","</div>"].join("\n");var g=$(e).hide().css(c.css||{position:"fixed"}),f=g.children(".loading-indicator-text");if(c.cover){g.css({"z-index":2,top:a.css("top"),bottom:a.css("bottom"),left:a.css("left"),right:a.css("right"),opacity:0.5,"background-color":"white","text-align":"center"});f=g.children(".loading-indicator-text").css({"margin-top":"20px"})}else{f=g.children(".loading-indicator-text").css({margin:"12px 0px 0px 10px",opacity:"0.85",color:"grey"});f.children(".loading-indicator-message").css({margin:"0px 8px 0px 0px","font-style":"italic"})}return g}b.show=function(f,e,g){f=f||"loading...";e=e||"fast";a.parent().find(".loading-indicator").remove();b.$indicator=d().insertBefore(a);b.message(f);b.$indicator.fadeIn(e,g);return b};b.message=function(e){b.$indicator.find("i").text(e)};b.hide=function(e,f){e=e||"fast";if(b.$indicator&&b.$indicator.size()){b.$indicator.fadeOut(e,function(){b.$indicator.remove();if(f){f()}})}else{if(f){f()}}return b};return b}(function(){var b=window._l||function(d){return d};function a(k,q){var e=27,n=13,d=$(k),f=true,h={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(r){},minSearchLen:0,escWillClear:true,oninit:function(){}};function j(r){var s=$(this).parent().children("input");s.focus().val("").trigger("clear:searchInput");q.onclear()}function p(s,r){$(this).trigger("search:searchInput",r);if(typeof q.onfirstsearch==="function"&&f){f=false;q.onfirstsearch(r)}else{q.onsearch(r)}}function g(){return['<input type="text" name="',q.name,'" placeholder="',q.placeholder,'" ','class="search-query ',q.classes,'" ',"/>"].join("")}function m(){return $(g()).focus(function(r){$(this).select()}).keyup(function(s){s.preventDefault();s.stopPropagation();if(!$(this).val()){$(this).blur()}if(s.which===e&&q.escWillClear){j.call(this,s)}else{var r=$(this).val();if((s.which===n)||(q.minSearchLen&&r.length>=q.minSearchLen)){p.call(this,s,r)}else{if(!r.length){j.call(this,s)}}}}).on("change",function(r){p.call(this,r,$(this).val())}).val(q.initialVal)}function l(){return $(['<span class="search-clear fa fa-times-circle" ','title="',b("clear search (esc)"),'"></span>'].join("")).tooltip({placement:"bottom"}).click(function(r){j.call(this,r)})}function o(){return $(['<span class="search-loading fa fa-spinner fa-spin" ','title="',b("loading..."),'"></span>'].join("")).hide().tooltip({placement:"bottom"})}function i(){d.find(".search-loading").toggle();d.find(".search-clear").toggle()}if(jQuery.type(q)==="string"){if(q==="toggle-loading"){i()}return d}if(jQuery.type(q)==="object"){q=jQuery.extend(true,{},h,q)}return d.addClass("search-input").prepend([m(),l(),o()])}jQuery.fn.extend({searchInput:function c(d){return this.each(function(){return a(this,d)})}})}());(function(){function c(o,n){this.currModeIndex=0;return this._init(o,n)}c.prototype.DATA_KEY="mode-button";c.prototype.defaults={switchModesOnClick:true};c.prototype._init=function j(o,n){n=n||{};this.$element=$(o);this.options=jQuery.extend(true,{},this.defaults,n);if(!n.modes){throw new Error('ModeButton requires a "modes" array')}var q=this;this.$element.click(function p(r){q.callModeFn();if(q.options.switchModesOnClick){q._incModeIndex()}$(this).html(q.options.modes[q.currModeIndex].html)});return this.reset()};c.prototype._incModeIndex=function l(){this.currModeIndex+=1;if(this.currModeIndex>=this.options.modes.length){this.currModeIndex=0}return this};c.prototype._getModeIndex=function f(n){for(var o=0;o<this.options.modes.length;o+=1){if(this.options.modes[o].mode===n){return o}}throw new Error("mode not found: "+n)};c.prototype._setModeByIndex=function m(n){var o=this.options.modes[n];if(!o){throw new Error("mode index not found: "+n)}this.currModeIndex=n;if(o.html){this.$element.html(o.html)}return this};c.prototype.currentMode=function d(){return this.options.modes[this.currModeIndex]};c.prototype.current=function i(){return this.currentMode().mode};c.prototype.getMode=function g(n){if(!n){return this.currentMode()}return this.options.modes[(this._getModeIndex(n))]};c.prototype.hasMode=function b(n){try{return !!this.getMode(n)}catch(o){}return false};c.prototype.setMode=function a(n){return this._setModeByIndex(this._getModeIndex(n))};c.prototype.reset=function h(){this.currModeIndex=0;if(this.options.initialMode){this.currModeIndex=this._getModeIndex(this.options.initialMode)}return this._setModeByIndex(this.currModeIndex)};c.prototype.callModeFn=function e(n){var o=this.getMode(n).onclick;if(o&&jQuery.type(o==="function")){return o.call(this.$element.get(0))}return undefined};jQuery.fn.extend({modeButton:function k(n){if(!this.size()){return this}if(jQuery.type(n)==="object"){return this.map(function(){var r=$(this);r.data("mode-button",new c(r,n));return this})}var p=$(this[0]),o=p.data("mode-button");if(!o){throw new Error("modeButton needs an options object or string name of a function")}if(o&&jQuery.type(n)==="string"){var q=n;if(o&&jQuery.type(o[q])==="function"){return o[q].apply(o,jQuery.makeArray(arguments).slice(1))}}return o}})}()); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.