diff --git a/.ci/py3_sources.txt b/.ci/py3_sources.txt index d52ac5da90b..87e88f16894 100644 --- a/.ci/py3_sources.txt +++ b/.ci/py3_sources.txt @@ -47,6 +47,8 @@ lib/galaxy/tours/ lib/galaxy/util/ lib/galaxy/visualization/ lib/galaxy/web/buildapp.py +lib/galaxy/web/framework/base.py +lib/galaxy/web/framework/decorators.py lib/galaxy/web/framework/__init__.py lib/galaxy/web/framework/middleware/error.py lib/galaxy/web/framework/middleware/static.py diff --git a/README.rst b/README.rst index 3db8f44c9c3..0abd2e598a2 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -.. figure:: https://wiki.galaxyproject.org/Images/GalaxyLogo?action=AttachFile&do=get&target=galaxy_project_logo.jpg +.. figure:: https://galaxyproject.org/images/galaxy-logos/galaxy_project_logo.jpg :alt: Galaxy Logo The latest information about Galaxy is available via `https://galaxyproject.org/ `__ diff --git a/client/galaxy/scripts/mvc/collection/base-creator.js b/client/galaxy/scripts/mvc/collection/base-creator.js new file mode 100644 index 00000000000..351406f939d --- /dev/null +++ b/client/galaxy/scripts/mvc/collection/base-creator.js @@ -0,0 +1,106 @@ +define([ +], function( ){ + +/* For presentation-related functionality shared across collection creators. + Particularily overlapping functionality related to name processing and help. +*/ +var CollectionCreatorMixin = { + + /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */ + _validationWarning : function( what, clear ){ + var VALIDATION_CLASS = 'validation-warning'; + if( what === 'name' ){ + what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) ); + this.$( '.collection-name' ).focus().select(); + } + if( clear ){ + what = what || this.$( '.' + VALIDATION_CLASS ); + what.removeClass( VALIDATION_CLASS ); + } else { + what.addClass( VALIDATION_CLASS ); + } + }, + + // ........................................................................ footer + /** handle a collection name change */ + _changeName : function( ev ){ + this._validationWarning( 'name', !!this._getName() ); + }, + + /** check for enter key press when in the collection name and submit */ + _nameCheckForEnter : function( ev ){ + if( ev.keyCode === 13 && !this.blocking ){ + this._clickCreate(); + } + }, + + /** get the current collection name */ + _getName : function(){ + return _.escape( this.$( '.collection-name' ).val() ); + }, + + // ........................................................................ header + /** expand help */ + _clickMoreHelp : function( ev ){ + ev.stopPropagation(); + this.$( '.main-help' ).addClass( 'expanded' ); + this.$( '.more-help' ).hide(); + }, + /** collapse help */ + _clickLessHelp : function( ev ){ + ev.stopPropagation(); + this.$( '.main-help' ).removeClass( 'expanded' ); + this.$( '.more-help' ).show(); + }, + /** toggle help */ + _toggleHelp : function( ev ){ + ev.stopPropagation(); + this.$( '.main-help' ).toggleClass( 'expanded' ); + this.$( '.more-help' ).toggle(); + }, + + /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */ + _showAlert : function( message, alertClass ){ + alertClass = alertClass || 'alert-danger'; + this.$( '.main-help' ).hide(); + this.$( '.header .alert' ) + .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show() + .find( '.alert-message' ).html( message ); + }, + /** hide the alerts at the top */ + _hideAlert : function( message ){ + this.$( '.main-help' ).show(); + this.$( '.header .alert' ).hide(); + }, + + _cancelCreate: function( ev ){ + if( typeof this.oncancel === 'function' ){ + this.oncancel.call( this ); + } + }, + + /** attempt to create the current collection */ + _clickCreate : function( ev ){ + var name = this._getName(); + if( !name ){ + this._validationWarning( 'name' ); + } else if( !this.blocking ){ + this.createList( name ); + } + }, + + _creatorTemplates: { + main : _.template([ + '
', + '
', + '' + ].join('')), + } + +} + +//============================================================================== + return { + CollectionCreatorMixin: CollectionCreatorMixin + }; +}); diff --git a/client/galaxy/scripts/mvc/collection/list-collection-creator.js b/client/galaxy/scripts/mvc/collection/list-collection-creator.js index 5d7b75741be..f63f0847d03 100644 --- a/client/galaxy/scripts/mvc/collection/list-collection-creator.js +++ b/client/galaxy/scripts/mvc/collection/list-collection-creator.js @@ -3,15 +3,17 @@ define([ "mvc/history/hdca-model", "mvc/dataset/states", "mvc/base-mvc", + "mvc/collection/base-creator", "mvc/ui/ui-modal", "utils/natural-sort", "utils/localization", "ui/hoverhighlight" -], function( HDCA, STATES, BASE_MVC, UI_MODAL, naturalSort, _l ){ +], function( HDCA, STATES, BASE_MVC, baseCreator, UI_MODAL, naturalSort, _l ){ 'use strict'; var logNamespace = 'collections'; + /*============================================================================== TODO: use proper Element model and not just json @@ -151,7 +153,7 @@ var DatasetCollectionElementView = Backbone.View.extend( BASE_MVC.LoggableMixin // ============================================================================ /** An interface for building collections. */ -var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend({ +var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({ _logNamespace : logNamespace, /** the class used to display individual elements */ @@ -367,21 +369,6 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten this._showAlert( this.templates.invalidElements({ problems: this.invalidElements }), 'alert-warning' ); }, - /** add (or clear if clear is truthy) a validation warning to the DOM element described in what */ - _validationWarning : function( what, clear ){ - var VALIDATION_CLASS = 'validation-warning'; - if( what === 'name' ){ - what = this.$( '.collection-name' ).add( this.$( '.collection-name-prompt' ) ); - this.$( '.collection-name' ).focus().select(); - } - if( clear ){ - what = what || this.$( '.' + VALIDATION_CLASS ); - what.removeClass( VALIDATION_CLASS ); - } else { - what.addClass( VALIDATION_CLASS ); - } - }, - _disableNameAndCreate : function( disable ){ disable = !_.isUndefined( disable )? disable : true; if( disable ){ @@ -624,48 +611,10 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten // footer 'change .collection-name' : '_changeName', 'keydown .collection-name' : '_nameCheckForEnter', - 'click .cancel-create' : function( ev ){ - if( typeof this.oncancel === 'function' ){ - this.oncancel.call( this ); - } - }, + 'click .cancel-create' : '_cancelCreate', 'click .create-collection' : '_clickCreate'//, }, - // ........................................................................ header - /** expand help */ - _clickMoreHelp : function( ev ){ - ev.stopPropagation(); - this.$( '.main-help' ).addClass( 'expanded' ); - this.$( '.more-help' ).hide(); - }, - /** collapse help */ - _clickLessHelp : function( ev ){ - ev.stopPropagation(); - this.$( '.main-help' ).removeClass( 'expanded' ); - this.$( '.more-help' ).show(); - }, - /** toggle help */ - _toggleHelp : function( ev ){ - ev.stopPropagation(); - this.$( '.main-help' ).toggleClass( 'expanded' ); - this.$( '.more-help' ).toggle(); - }, - - /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*) */ - _showAlert : function( message, alertClass ){ - alertClass = alertClass || 'alert-danger'; - this.$( '.main-help' ).hide(); - this.$( '.header .alert' ) - .attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show() - .find( '.alert-message' ).html( message ); - }, - /** hide the alerts at the top */ - _hideAlert : function( message ){ - this.$( '.main-help' ).show(); - this.$( '.header .alert' ).hide(); - }, - // ........................................................................ elements /** reset all data to the initial state */ reset : function(){ @@ -789,46 +738,12 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten this.$dragging = null; }, - // ........................................................................ footer - /** handle a collection name change */ - _changeName : function( ev ){ - this._validationWarning( 'name', !!this._getName() ); - }, - - /** check for enter key press when in the collection name and submit */ - _nameCheckForEnter : function( ev ){ - if( ev.keyCode === 13 && !this.blocking ){ - this._clickCreate(); - } - }, - - /** get the current collection name */ - _getName : function(){ - return _.escape( this.$( '.collection-name' ).val() ); - }, - - /** attempt to create the current collection */ - _clickCreate : function( ev ){ - var name = this._getName(); - if( !name ){ - this._validationWarning( 'name' ); - } else if( !this.blocking ){ - this.createList( name ); - } - }, - // ------------------------------------------------------------------------ templates //TODO: move to require text plugin and load these as text //TODO: underscore currently unnecc. bc no vars are used //TODO: better way of localizing text-nodes in long strings /** underscore template fns attached to class */ - templates : { - /** the skeleton */ - main : _.template([ - '
', - '
', - '' - ].join('')), + templates : _.extend({}, baseCreator.CollectionCreatorMixin._creatorTemplates, { /** the header (not including help text) */ header : _.template([ @@ -974,7 +889,7 @@ var ListCollectionCreator = Backbone.View.extend( BASE_MVC.LoggableMixin ).exten '', '' ].join('')), - }, + }), // ------------------------------------------------------------------------ misc /** string rep */ diff --git a/client/galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js b/client/galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js index 23eca8a9bb2..264d61dde77 100644 --- a/client/galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js +++ b/client/galaxy/scripts/mvc/collection/list-of-pairs-collection-creator.js @@ -1,11 +1,11 @@ define([ "utils/levenshtein", "utils/natural-sort", - "mvc/collection/list-collection-creator", + "mvc/collection/base-creator", "mvc/base-mvc", "utils/localization", "ui/hoverhighlight" -], function( levenshteinDistance, naturalSort, LIST_COLLECTION_CREATOR, baseMVC, _l ){ +], function( levenshteinDistance, naturalSort, baseCreator, baseMVC, _l ){ 'use strict'; @@ -190,7 +190,7 @@ function autoPairFnBuilder( options ){ // ============================================================================ /** An interface for building collections of paired datasets. */ -var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).extend({ +var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).extend( baseCreator.CollectionCreatorMixin ).extend({ _logNamespace : logNamespace, className: 'list-of-pairs-collection-creator collection-creator flex-row-container', @@ -942,6 +942,7 @@ var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).exte // header 'click .more-help' : '_clickMoreHelp', 'click .less-help' : '_clickLessHelp', + 'click .main-help' : '_toggleHelp', 'click .header .alert button' : '_hideAlert', 'click .forward-column .column-title' : '_clickShowOnlyUnpaired', 'click .reverse-column .column-title' : '_clickShowOnlyUnpaired', @@ -981,39 +982,10 @@ var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).exte 'change .remove-extensions' : function( ev ){ this.toggleExtensions(); }, 'change .collection-name' : '_changeName', 'keydown .collection-name' : '_nameCheckForEnter', - 'click .cancel-create' : function( ev ){ - if( typeof this.oncancel === 'function' ){ - this.oncancel.call( this ); - } - }, + 'click .cancel-create' : '_cancelCreate', 'click .create-collection' : '_clickCreate'//, }, - // ........................................................................ header - /** expand help */ - _clickMoreHelp : function( ev ){ - this.$( '.main-help' ).addClass( 'expanded' ); - this.$( '.more-help' ).hide(); - }, - /** collapse help */ - _clickLessHelp : function( ev ){ - this.$( '.main-help' ).removeClass( 'expanded' ); - this.$( '.more-help' ).show(); - }, - - /** show an alert on the top of the interface containing message (alertClass is bootstrap's alert-*)*/ - _showAlert : function( message, alertClass ){ - alertClass = alertClass || 'alert-danger'; - this.$( '.main-help' ).hide(); - this.$( '.header .alert' ).attr( 'class', 'alert alert-dismissable' ).addClass( alertClass ).show() - .find( '.alert-message' ).html( message ); - }, - /** hide the alerts at the top */ - _hideAlert : function( message ){ - this.$( '.main-help' ).show(); - this.$( '.header .alert' ).hide(); - }, - /** toggle between showing only unpaired and split view */ _clickShowOnlyUnpaired : function( ev ){ //this.debug( 'click unpaired', ev.currentTarget ); @@ -1419,33 +1391,6 @@ var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).exte creator._renderFooter(); }, - /** handle a collection name change */ - _changeName : function( ev ){ - this._validationWarning( 'name', !!this._getName() ); - }, - - /** check for enter key press when in the collection name and submit */ - _nameCheckForEnter : function( ev ){ - if( ev.keyCode === 13 && !this.blocking ){ - this._clickCreate(); - } - }, - - /** get the current collection name */ - _getName : function(){ - return _.escape( this.$( '.collection-name' ).val() ); - }, - - /** attempt to create the current collection */ - _clickCreate : function( ev ){ - var name = this._getName(); - if( !name ){ - this._validationWarning( 'name' ); - } else if( !this.blocking ){ - this.createList(); - } - }, - // ------------------------------------------------------------------------ misc /** debug a dataset list */ _printList : function( list ){ @@ -1473,14 +1418,7 @@ var PairedCollectionCreator = Backbone.View.extend( baseMVC.LoggableMixin ).exte //TODO: underscore currently unnecc. bc no vars are used //TODO: better way of localizing text-nodes in long strings /** underscore template fns attached to class */ -PairedCollectionCreator.templates = PairedCollectionCreator.templates || { - - /** the skeleton */ - main : _.template([ - '
', - '
', - '