commit/galaxy-central: carlfeberhard: Added history.js templates: icon-button partial, hdaSummary, titleLink; packed scripts
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/802b87d64910/ changeset: 802b87d64910 user: carlfeberhard date: 2012-09-13 17:58:14 summary: Added history.js templates: icon-button partial, hdaSummary, titleLink; packed scripts affected #: 25 files diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/mvc/history.js --- a/static/scripts/mvc/history.js +++ b/static/scripts/mvc/history.js @@ -124,8 +124,12 @@ }, isEditable : function(){ - // roughly can_edit from history_common.mako - return ( !( this.get( 'deleted' ) || this.get( 'purged' ) ) ); + // roughly can_edit from history_common.mako - not deleted or purged = editable + return ( + //this.get( 'for_editing' ) + //&& !( this.get( 'deleted' ) || this.get( 'purged' ) ) + !( this.get( 'deleted' ) || this.get( 'purged' ) ) + ); }, hasData : function(){ @@ -159,10 +163,11 @@ //============================================================================== var HistoryItemView = BaseView.extend( LoggableMixin ).extend({ + //??TODO: add alias in initialize this.hda = this.model? // view for HistoryItem model above // uncomment this out see log messages - //logger : console, + logger : console, tagName : "div", className : "historyItemContainer", @@ -179,6 +184,7 @@ this.log( this + '.model:', this.model ); var id = this.model.get( 'id' ), state = this.model.get( 'state' ); + this.clearReferences(); this.$el.attr( 'id', 'historyItemContainer-' + id ); @@ -191,7 +197,7 @@ this.body = $( this._render_body() ); itemWrapper.append( this.body ); - // set up canned behavior (bootstrap, popupmenus, editable_text, etc.) + // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.) itemWrapper.find( '.tooltip' ).tooltip({ placement : 'bottom' }); //TODO: broken @@ -206,6 +212,14 @@ return this.$el.append( itemWrapper ); }, + clearReferences : function(){ + //??TODO: best way? + this.displayButton = null; + this.editButton = null; + this.deleteButton = null; + this.errButton = null; + }, + // ................................................................................ RENDER WARNINGS _render_warnings : function(){ // jQ errs on building dom with whitespace - if there are no messages, trim -> '' @@ -224,16 +238,10 @@ // ................................................................................ DISPLAY, EDIT ATTR, DELETE _render_titleButtons : function(){ // render the display, edit attr and delete icon-buttons - var buttonDiv = $( '<div class="historyItemButtons"></div>' ), - for_editing = this.model.get( 'for_editing' ); - - // don't show display, edit while uploading - if( this.model.get( 'state' ) !== HistoryItem.STATES.UPLOAD ){ - buttonDiv.append( this._render_displayButton() ); - - if( for_editing ){ buttonDiv.append( this._render_editButton() ); } - } - if( for_editing ){ buttonDiv.append( this._render_deleteButton() ); } + var buttonDiv = $( '<div class="historyItemButtons"></div>' ); + buttonDiv.append( this._render_displayButton() ); + buttonDiv.append( this._render_editButton() ); + buttonDiv.append( this._render_deleteButton() ); return buttonDiv; }, @@ -241,15 +249,19 @@ //TODO: move other data (non-href) into {} in view definition, cycle over those keys in _titlebuttons //TODO: move disabled span data into view def, move logic into _titlebuttons _render_displayButton : function(){ + + // don't show display while uploading + if( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD ){ return null; } + + // show a disabled display if the data's been purged displayBtnData = ( this.model.get( 'purged' ) )?({ - // show a disabled display if the data's been purged title : 'Cannot display datasets removed from disk', + enabled : false, icon_class : 'display', - enabled : false, + + // if not, render the display icon-button with href }):({ - // if not, render the display icon-button with href title : 'Display data in browser', - //TODO: need generated url here href : this.model.get( 'display_url' ), target : ( this.model.get( 'for_editing' ) )?( 'galaxy_main' ):( null ), icon_class : 'display', @@ -259,32 +271,39 @@ }, _render_editButton : function(){ - // render the edit attr icon-button - var id = this.model.get( 'id' ), - purged = this.model.get( 'purged' ), - deleted = this.model.get( 'deleted' ); + + // don't show edit while uploading, or if editable + if( ( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD ) + || ( !this.model.get( 'for_editing' ) ) ){ + return null; + } + + var purged = this.model.get( 'purged' ), + deleted = this.model.get( 'deleted' ), + editBtnData = { + title : 'Edit attributes', + href : this.model.get( 'edit_url' ), + target : 'galaxy_main', + icon_class : 'edit' + }; - var editBtnData = { - title : 'Edit attributes', - href : this.model.get( 'edit_url' ), - target : 'galaxy_main', - icon_class : 'edit' - } // disable if purged or deleted and explain why in the tooltip //TODO: if for_editing if( deleted || purged ){ - editBtnData = { - enabled : false, - icon_class : 'edit' - }; - editBtnData.title = ( !purged )?( 'Undelete dataset to edit attributes' ): - ( 'Cannot edit attributes of datasets removed from disk' ); + editBtnData.enabled = false; } + if( deleted ){ + editBtnData.title = 'Undelete dataset to edit attributes'; + } else if( purged ){ + editBtnData.title = 'Cannot edit attributes of datasets removed from disk'; + } + this.editButton = new IconButtonView({ model : new IconButton( editBtnData ) }); return this.editButton.render().$el; }, _render_deleteButton : function(){ + // don't show delete if not editable if( !this.model.get( 'for_editing' ) ){ return null; } var deleteBtnData = ( this.model.get( 'delete_url' ) )?({ @@ -303,14 +322,8 @@ }, _render_titleLink : function(){ - // render the title (hda name) - var h_name = this.model.get( 'name' ), - hid = this.model.get( 'hid' ); - title = ( hid + ': ' + h_name ); - return $( linkHTMLTemplate({ - href : 'javascript:void(0);', - text : '<span class="historyItemTitle">' + title + '</span>' - })); + this.log( 'model:', this.model.toJSON() ); + return $( jQuery.trim( HistoryItemView.templates.titleLink( this.model.toJSON() ) ) ); }, // ................................................................................ RENDER BODY @@ -344,12 +357,14 @@ // bug report button //NOTE: these are shown _before_ info, rerun so use _prepend_ if( this.model.get( 'for_editing' ) ){ - actionBtnDiv.prepend( $( linkHTMLTemplate({ + //TODO??: save to view 'this.errButton' + this.errButton = new IconButtonView({ model : new IconButton({ title : 'View or report this error', - href : this.model.get( 'report_errors_url' ), + href : this.model.get( 'report_error_url' ), target : 'galaxy_main', - classes : [ 'icon-button', 'tooltip', 'bug' ] - }))); + icon_class : 'bug' + })}); + actionBtnDiv.prepend( this.errButton.render().$el ); } if( this.model.hasData() ){ //TODO: render_download_links( data, dataset_id ) @@ -568,37 +583,35 @@ }, _render_hdaSummary : function(){ - // default span rendering - var dbkeyHTML = _.template( '<span class="<%= dbkey %>"><%= dbkey %></span>', - { dbkey: this.model.get( 'metadata_dbkey' ) } ); - // if there's no dbkey and it's editable : render a link to editing in the '?' - if( this.model.get( 'metadata_dbkey' ) === '?' && this.model.isEditable() ){ - dbkeyHTML = linkHTMLTemplate({ - text : this.model.get( 'metadata_dbkey' ), - href : this.model.get( 'edit_url' ), - target : 'galaxy_main' - }); + var modelData = this.model.toJSON(); + + // if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?' + if( this.model.get( 'metadata_dbkey' ) === '?' + && this.model.isEditable() ){ + _.extend( modelData, { dbkey_unknown_and_editable : true }); } - return ( HistoryItemView.TEMPLATES.hdaSummary( - _.extend({ dbkeyHTML: dbkeyHTML }, this.model.attributes ) ) ); + return HistoryItemView.templates.hdaSummary( modelData ); }, _render_showParamsAndRerun : function(){ //TODO??: generalize to _render_actionButtons, pass in list of 'buttons' to render, default to these two var actionBtnDiv = $( '<div/>' ); - actionBtnDiv.append( $( linkHTMLTemplate({ + + this.showParamsButton = new IconButtonView({ model : new IconButton({ title : 'View details', href : this.model.get( 'show_params_url' ), target : 'galaxy_main', - classes : [ 'icon-button', 'tooltip', 'information' ] - }))); + icon_class : 'information' + }) }); + actionBtnDiv.append( this.showParamsButton.render().$el ); + if( this.model.get( 'for_editing' ) ){ - actionBtnDiv.append( $( linkHTMLTemplate({ + this.rerunButton = new IconButtonView({ model : new IconButton({ title : 'Run this job again', href : this.model.get( 'rerun_url' ), target : 'galaxy_main', - classes : [ 'icon-button', 'tooltip', 'arrow-circle' ] - }))); + icon_class : 'arrow-circle' + }) }); } return actionBtnDiv; }, @@ -748,24 +761,14 @@ return 'HistoryItemView(' + modelString + ')'; } }); -HistoryItemView.TEMPLATES = {}; - -//TODO: contains localized strings -HistoryItemView.TEMPLATES.hdaSummary = _.template([ - '<%= misc_blurb %><br />', - 'format: <span class="<%= data_type %>"><%= data_type %></span>, ', - 'database: <%= dbkeyHTML %>' -].join( '' )); //============================================================================== //HistoryItemView.templates = InDomTemplateLoader.getTemplates({ HistoryItemView.templates = CompiledTemplateLoader.getTemplates({ - 'common-templates.html' : { - warningMsg : 'template-warningmessagesmall', - }, 'history-templates.html' : { - messages : 'template-history-warning-messages2', + messages : 'template-history-warning-messages', + titleLink : 'template-history-titleLink', hdaSummary : 'template-history-hdaSummary' } }); @@ -1039,7 +1042,8 @@ { state : HistoryItem.STATES.EMPTY }), error : _.extend( _.clone( mockHistory.data.template ), - { state : HistoryItem.STATES.ERROR }), + { state : HistoryItem.STATES.ERROR, + report_error_url: 'example.com/report_err' }), discarded : _.extend( _.clone( mockHistory.data.template ), { state : HistoryItem.STATES.DISCARDED }), diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/libs/handlebars.full.js --- /dev/null +++ b/static/scripts/packed/libs/handlebars.full.js @@ -0,0 +1,1 @@ +var Handlebars={};Handlebars.VERSION="1.0.beta.6";Handlebars.helpers={};Handlebars.partials={};Handlebars.registerHelper=function(b,c,a){if(a){c.not=a}this.helpers[b]=c};Handlebars.registerPartial=function(a,b){this.partials[a]=b};Handlebars.registerHelper("helperMissing",function(a){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+a+"'")}});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper("blockHelperMissing",function(f,d){var a=d.inverse||function(){},h=d.fn;var c="";var g=toString.call(f);if(g===functionType){f=f.call(this)}if(f===true){return h(this)}else{if(f===false||f==null){return a(this)}else{if(g==="[object Array]"){if(f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+h(f[e])}}else{c=a(this)}return c}else{return h(f)}}}});Handlebars.registerHelper("each",function(f,d){var g=d.fn,a=d.inverse;var c="";if(f&&f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+g(f[e])}}else{c=a(this)}return c});Handlebars.registerHelper("if",function(b,a){var c=toString.call(b);if(c===functionType){b=b.call(this)}if(!b||Handlebars.Utils.isEmpty(b)){return a.inverse(this)}else{return a.fn(this)}});Handlebars.registerHelper("unless",function(c,b){var d=b.fn,a=b.inverse;b.fn=a;b.inverse=d;return Handlebars.helpers["if"].call(this,c,b)});Handlebars.registerHelper("with",function(b,a){return a.fn(b)});Handlebars.registerHelper("log",function(a){Handlebars.log(a)});var handlebars=(function(){var f={trace:function c(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,INTEGER:29,BOOLEAN:30,hashSegments:31,hashSegment:32,ID:33,EQUALS:34,pathSegments:35,SEP:36,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function b(g,j,k,n,m,i,l){var h=i.length-1;switch(m){case 1:return i[h-1];break;case 2:this.$=new n.ProgramNode(i[h-2],i[h]);break;case 3:this.$=new n.ProgramNode(i[h]);break;case 4:this.$=new n.ProgramNode([]);break;case 5:this.$=[i[h]];break;case 6:i[h-1].push(i[h]);this.$=i[h-1];break;case 7:this.$=new n.InverseNode(i[h-2],i[h-1],i[h]);break;case 8:this.$=new n.BlockNode(i[h-2],i[h-1],i[h]);break;case 9:this.$=i[h];break;case 10:this.$=i[h];break;case 11:this.$=new n.ContentNode(i[h]);break;case 12:this.$=new n.CommentNode(i[h]);break;case 13:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 14:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 15:this.$=i[h-1];break;case 16:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 17:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1],true);break;case 18:this.$=new n.PartialNode(i[h-1]);break;case 19:this.$=new n.PartialNode(i[h-2],i[h-1]);break;case 20:break;case 21:this.$=[[i[h-2]].concat(i[h-1]),i[h]];break;case 22:this.$=[[i[h-1]].concat(i[h]),null];break;case 23:this.$=[[i[h-1]],i[h]];break;case 24:this.$=[[i[h]],null];break;case 25:i[h-1].push(i[h]);this.$=i[h-1];break;case 26:this.$=[i[h]];break;case 27:this.$=i[h];break;case 28:this.$=new n.StringNode(i[h]);break;case 29:this.$=new n.IntegerNode(i[h]);break;case 30:this.$=new n.BooleanNode(i[h]);break;case 31:this.$=new n.HashNode(i[h]);break;case 32:i[h-1].push(i[h]);this.$=i[h-1];break;case 33:this.$=[i[h]];break;case 34:this.$=[i[h-2],i[h]];break;case 35:this.$=[i[h-2],new n.StringNode(i[h])];break;case 36:this.$=[i[h-2],new n.IntegerNode(i[h])];break;case 37:this.$=[i[h-2],new n.BooleanNode(i[h])];break;case 38:this.$=new n.IdNode(i[h]);break;case 39:i[h-2].push(i[h]);this.$=i[h-2];break;case 40:this.$=[i[h]];break}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function d(h,g){throw new Error(h)},parse:function e(o){var x=this,l=[0],G=[null],s=[],H=this.table,h="",q=0,E=0,j=0,n=2,u=1;this.lexer.setInput(o);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;if(typeof this.lexer.yylloc=="undefined"){this.lexer.yylloc={}}var i=this.lexer.yylloc;s.push(i);if(typeof this.yy.parseError==="function"){this.parseError=this.yy.parseError}function w(p){l.length=l.length-2*p;G.length=G.length-p;s.length=s.length-p}function v(){var p;p=x.lexer.lex()||1;if(typeof p!=="number"){p=x.symbols_[p]||p}return p}var D,z,k,C,I,t,B={},y,F,g,m;while(true){k=l[l.length-1];if(this.defaultActions[k]){C=this.defaultActions[k]}else{if(D==null){D=v()}C=H[k]&&H[k][D]}if(typeof C==="undefined"||!C.length||!C[0]){if(!j){m=[];for(y in H[k]){if(this.terminals_[y]&&y>2){m.push("'"+this.terminals_[y]+"'")}}var A="";if(this.lexer.showPosition){A="Parse error on line "+(q+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+m.join(", ")+", got '"+this.terminals_[D]+"'"}else{A="Parse error on line "+(q+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'")}this.parseError(A,{text:this.lexer.match,token:this.terminals_[D]||D,line:this.lexer.yylineno,loc:i,expected:m})}}if(C[0] instanceof Array&&C.length>1){throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+D)}switch(C[0]){case 1:l.push(D);G.push(this.lexer.yytext);s.push(this.lexer.yylloc);l.push(C[1]);D=null;if(!z){E=this.lexer.yyleng;h=this.lexer.yytext;q=this.lexer.yylineno;i=this.lexer.yylloc;if(j>0){j--}}else{D=z;z=null}break;case 2:F=this.productions_[C[1]][1];B.$=G[G.length-F];B._$={first_line:s[s.length-(F||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(F||1)].first_column,last_column:s[s.length-1].last_column};t=this.performAction.call(B,h,E,q,this.yy,C[1],G,s);if(typeof t!=="undefined"){return t}if(F){l=l.slice(0,-1*F*2);G=G.slice(0,-1*F);s=s.slice(0,-1*F)}l.push(this.productions_[C[1]][0]);G.push(B.$);s.push(B._$);g=H[l[l.length-2]][l[l.length-1]];l.push(g);break;case 3:return true}}return true}};var a=(function(){var j=({EOF:1,parseError:function l(o,n){if(this.yy.parseError){this.yy.parseError(o,n)}else{throw new Error(o)}},setInput:function(n){this._input=n;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this},input:function(){var o=this._input[0];this.yytext+=o;this.yyleng++;this.match+=o;this.matched+=o;var n=o.match(/\n/);if(n){this.yylineno++}this._input=this._input.slice(1);return o},unput:function(n){this._input=n+this._input;return this},more:function(){this._more=true;return this},pastInput:function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var n=this.match;if(n.length<20){n+=this._input.substr(0,20-n.length)}return(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var n=this.pastInput();var o=new Array(n.length+1).join("-");return n+this.upcomingInput()+"\n"+o+"^"},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var r,p,o,n;if(!this._more){this.yytext="";this.match=""}var s=this._currentRules();for(var q=0;q<s.length;q++){p=this._input.match(this.rules[s[q]]);if(p){n=p[0].match(/\n.*/g);if(n){this.yylineno+=n.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-1:this.yylloc.last_column+p[0].length};this.yytext+=p[0];this.match+=p[0];this.matches=p;this.yyleng=this.yytext.length;this._more=false;this._input=this._input.slice(p[0].length);this.matched+=p[0];r=this.performAction.call(this,this.yy,this,s[q],this.conditionStack[this.conditionStack.length-1]);if(r){return r}else{return}}}if(this._input===""){return this.EOF}else{this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function g(){var n=this.next();if(typeof n!=="undefined"){return n}else{return this.lex()}},begin:function h(n){this.conditionStack.push(n)},popState:function m(){return this.conditionStack.pop()},_currentRules:function k(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function h(n){this.begin(n)}});j.performAction=function i(r,o,q,n){var p=n;switch(q){case 0:if(o.yytext.slice(-1)!=="\\"){this.begin("mu")}if(o.yytext.slice(-1)==="\\"){o.yytext=o.yytext.substr(0,o.yyleng-1),this.begin("emu")}if(o.yytext){return 14}break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:return 24;break;case 4:return 16;break;case 5:return 20;break;case 6:return 19;break;case 7:return 19;break;case 8:return 23;break;case 9:return 23;break;case 10:o.yytext=o.yytext.substr(3,o.yyleng-5);this.popState();return 15;break;case 11:return 22;break;case 12:return 34;break;case 13:return 33;break;case 14:return 33;break;case 15:return 36;break;case 16:break;case 17:this.popState();return 18;break;case 18:this.popState();return 18;break;case 19:o.yytext=o.yytext.substr(1,o.yyleng-2).replace(/\\"/g,'"');return 28;break;case 20:return 30;break;case 21:return 30;break;case 22:return 29;break;case 23:return 33;break;case 24:o.yytext=o.yytext.substr(1,o.yyleng-2);return 33;break;case 25:return"INVALID";break;case 26:return 5;break}};j.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];j.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:false},emu:{rules:[2],inclusive:false},INITIAL:{rules:[0,1,26],inclusive:true}};return j})();f.lexer=a;return f})();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=handlebars;exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)};exports.main=function commonjsMain(a){if(!a[1]){throw new Error("Usage: "+a[0]+" FILE")}if(typeof process!=="undefined"){var c=require("fs").readFileSync(require("path").join(process.cwd(),a[1]),"utf8")}else{var b=require("file").path(require("file").cwd());var c=b.join(a[1]).read({charset:"utf-8"})}return exports.parser.parse(c)};if(typeof module!=="undefined"&&require.main===module){exports.main(typeof process!=="undefined"?process.argv.slice(1):require("system").args)}}Handlebars.Parser=handlebars;Handlebars.parse=function(a){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(a)};Handlebars.print=function(a){return new Handlebars.PrintVisitor().accept(a)};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(b,a){}};Handlebars.log=function(b,a){Handlebars.logger.log(b,a)};(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(c,b){this.type="program";this.statements=c;if(b){this.inverse=new Handlebars.AST.ProgramNode(b)}};Handlebars.AST.MustacheNode=function(d,c,b){this.type="mustache";this.id=d[0];this.params=d.slice(1);this.hash=c;this.escaped=!b};Handlebars.AST.PartialNode=function(c,b){this.type="partial";this.id=c;this.context=b};var a=function(b,c){if(b.original!==c.original){throw new Handlebars.Exception(b.original+" doesn't match "+c.original)}};Handlebars.AST.BlockNode=function(c,b,d){a(c.id,d);this.type="block";this.mustache=c;this.program=b};Handlebars.AST.InverseNode=function(c,b,d){a(c.id,d);this.type="inverse";this.mustache=c;this.program=b};Handlebars.AST.ContentNode=function(b){this.type="content";this.string=b};Handlebars.AST.HashNode=function(b){this.type="hash";this.pairs=b};Handlebars.AST.IdNode=function(f){this.type="ID";this.original=f.join(".");var d=[],g=0;for(var e=0,b=f.length;e<b;e++){var c=f[e];if(c===".."){g++}else{if(c==="."||c==="this"){this.isScoped=true}else{d.push(c)}}}this.parts=d;this.string=d.join(".");this.depth=g;this.isSimple=(d.length===1)&&(g===0)};Handlebars.AST.StringNode=function(b){this.type="STRING";this.string=b};Handlebars.AST.IntegerNode=function(b){this.type="INTEGER";this.integer=b};Handlebars.AST.BooleanNode=function(b){this.type="BOOLEAN";this.bool=b};Handlebars.AST.CommentNode=function(b){this.type="comment";this.comment=b}})();Handlebars.Exception=function(b){var a=Error.prototype.constructor.apply(this,arguments);for(var c in a){if(a.hasOwnProperty(c)){this[c]=a[c]}}this.message=a.message};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var c={"<":"<",">":">",'"':""","'":"'","`":"`"};var d=/&(?!\w+;)|[<>"'`]/g;var b=/[&<>"'`]/;var a=function(e){return c[e]||"&"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!b.test(e)){return e}return e.replace(d,a)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};(function(f,e){f.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16};f.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1};f.DISASSEMBLE_MAP={};for(var h in f.OPCODE_MAP){var g=f.OPCODE_MAP[h];f.DISASSEMBLE_MAP[g]=h}f.multiParamSize=function(i){return f.MULTI_PARAM_OPCODES[f.DISASSEMBLE_MAP[i]]};f.prototype={compiler:f,disassemble:function(){var t=this.opcodes,r,n;var q=[],v,m,w;for(var s=0,o=t.length;s<o;s++){r=t[s];if(r==="DECLARE"){m=t[++s];w=t[++s];q.push("DECLARE "+m+" = "+w)}else{v=f.DISASSEMBLE_MAP[r];var u=f.multiParamSize(r);var k=[];for(var p=0;p<u;p++){n=t[++s];if(typeof n==="string"){n='"'+n.replace("\n","\\n")+'"'}k.push(n)}v=v+" "+k.join(" ");q.push(v)}}return q.join("\n")},guid:0,compile:function(i,k){this.children=[];this.depths={list:[]};this.options=k;var l=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(l){for(var j in l){this.options.knownHelpers[j]=l[j]}}return this.program(i)},accept:function(i){return this[i.type](i)},program:function(m){var k=m.statements,o;this.opcodes=[];for(var n=0,j=k.length;n<j;n++){o=k[n];this[o.type](o)}this.isSimple=j===1;this.depths.list=this.depths.list.sort(function(l,i){return l-i});return this},compileProgram:function(m){var j=new this.compiler().compile(m,this.options);var n=this.guid++;this.usePartial=this.usePartial||j.usePartial;this.children[n]=j;for(var o=0,k=j.depths.list.length;o<k;o++){depth=j.depths.list[o];if(depth<2){continue}else{this.addDepth(depth-1)}}return n},block:function(o){var l=o.mustache;var n,p,j,k;var m=this.setupStackForMustache(l);var i=this.compileProgram(o.program);if(o.program.inverse){k=this.compileProgram(o.program.inverse);this.declare("inverse",k)}this.opcode("invokeProgram",i,m.length,!!l.hash);this.declare("inverse",null);this.opcode("append")},inverse:function(k){var j=this.setupStackForMustache(k.mustache);var i=this.compileProgram(k.program);this.declare("inverse",i);this.opcode("invokeProgram",null,j.length,!!k.mustache.hash);this.declare("inverse",null);this.opcode("append")},hash:function(n){var m=n.pairs,p,o;this.opcode("push","{}");for(var k=0,j=m.length;k<j;k++){p=m[k];o=p[1];this.accept(o);this.opcode("assignToHash",p[0])}},partial:function(i){var j=i.id;this.usePartial=true;if(i.context){this.ID(i.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",j.original);this.opcode("append")},content:function(i){this.opcode("appendContent",i.string)},mustache:function(i){var j=this.setupStackForMustache(i);this.opcode("invokeMustache",j.length,i.id.original,!!i.hash);if(i.escaped&&!this.options.noEscape){this.opcode("appendEscaped")}else{this.opcode("append")}},ID:function(m){this.addDepth(m.depth);this.opcode("getContext",m.depth);this.opcode("lookupWithHelpers",m.parts[0]||null,m.isScoped||false);for(var k=1,j=m.parts.length;k<j;k++){this.opcode("lookup",m.parts[k])}},STRING:function(i){this.opcode("pushString",i.string)},INTEGER:function(i){this.opcode("push",i.integer)},BOOLEAN:function(i){this.opcode("push",i.bool)},comment:function(){},pushParams:function(l){var j=l.length,k;while(j--){k=l[j];if(this.options.stringParams){if(k.depth){this.addDepth(k.depth)}this.opcode("getContext",k.depth||0);this.opcode("pushStringParam",k.string)}else{this[k.type](k)}}},opcode:function(i,l,k,j){this.opcodes.push(f.OPCODE_MAP[i]);if(l!==undefined){this.opcodes.push(l)}if(k!==undefined){this.opcodes.push(k)}if(j!==undefined){this.opcodes.push(j)}},declare:function(i,j){this.opcodes.push("DECLARE");this.opcodes.push(i);this.opcodes.push(j)},addDepth:function(i){if(i===0){return}if(!this.depths[i]){this.depths[i]=true;this.depths.list.push(i)}},setupStackForMustache:function(i){var j=i.params;this.pushParams(j);if(i.hash){this.hash(i.hash)}this.ID(i.id);return j}};e.prototype={nameLookup:function(k,i,j){if(/^[0-9]+$/.test(i)){return k+"["+i+"]"}else{if(e.isValidJavaScriptVariableName(i)){return k+"."+i}else{return k+"['"+i+"']"}}},appendToBuffer:function(i){if(this.environment.isSimple){return"return "+i+";"}else{return"buffer += "+i+";"}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(i,j,l,k){this.environment=i;this.options=j||{};this.name=this.environment.name;this.isChild=!!l;this.context=l||{programs:[],aliases:{self:"this"},registers:{list:[]}};this.preamble();this.stackSlot=0;this.stackVars=[];this.compileChildren(i,j);var n=i.opcodes,m;this.i=0;for(b=n.length;this.i<b;this.i++){m=this.nextOpcode(0);if(m[0]==="DECLARE"){this.i=this.i+2;this[m[1]]=m[2]}else{this.i=this.i+m[1].length;this[m[0]].apply(this,m[1])}}return this.createFunctionContext(k)},nextOpcode:function(r){var o=this.environment.opcodes,m=o[this.i+r],l,p;var q,i;if(m==="DECLARE"){l=o[this.i+1];p=o[this.i+2];return["DECLARE",l,p]}else{l=f.DISASSEMBLE_MAP[m];q=f.multiParamSize(m);i=[];for(var k=0;k<q;k++){i.push(o[this.i+k+1+r])}return[l,i]}},eat:function(i){this.i=this.i+i.length},preamble:function(){var i=[];this.useRegister("foundHelper");if(!this.isChild){var j=this.namespace;var k="helpers = helpers || "+j+".helpers;";if(this.environment.usePartial){k=k+" partials = partials || "+j+".partials;"}i.push(k)}else{i.push("")}if(!this.environment.isSimple){i.push(", buffer = "+this.initializeBuffer())}else{i.push("")}this.lastContext=0;this.source=i},createFunctionContext:function(p){var q=this.stackVars;if(!this.isChild){q=q.concat(this.context.registers.list)}if(q.length>0){this.source[1]=this.source[1]+", "+q.join(", ")}if(!this.isChild){var k=[];for(var o in this.context.aliases){this.source[1]=this.source[1]+", "+o+"="+this.context.aliases[o]}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.source.push("return buffer;")}var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var n=0,j=this.environment.depths.list.length;n<j;n++){r.push("depth"+this.environment.depths.list[n])}if(p){r.push(this.source.join("\n "));return Function.apply(this,r)}else{var m="function "+(this.name||"")+"("+r.join(",")+") {\n "+this.source.join("\n ")+"}";Handlebars.log(Handlebars.logger.DEBUG,m+"\n\n");return m}},appendContent:function(i){this.source.push(this.appendToBuffer(this.quotedString(i)))},append:function(){var i=this.popStack();this.source.push("if("+i+" || "+i+" === 0) { "+this.appendToBuffer(i)+" }");if(this.environment.isSimple){this.source.push("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){var j=this.nextOpcode(1),i="";this.context.aliases.escapeExpression="this.escapeExpression";if(j[0]==="appendContent"){i=" + "+this.quotedString(j[1][0]);this.eat(j)}this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+i))},getContext:function(i){if(this.lastContext!==i){this.lastContext=i}},lookupWithHelpers:function(k,l){if(k){var i=this.nextStack();this.usingKnownHelper=false;var j;if(!l&&this.options.knownHelpers[k]){j=i+" = "+this.nameLookup("helpers",k,"helper");this.usingKnownHelper=true}else{if(l||this.options.knownHelpersOnly){j=i+" = "+this.nameLookup("depth"+this.lastContext,k,"context")}else{this.register("foundHelper",this.nameLookup("helpers",k,"helper"));j=i+" = foundHelper || "+this.nameLookup("depth"+this.lastContext,k,"context")}}j+=";";this.source.push(j)}else{this.pushStack("depth"+this.lastContext)}},lookup:function(j){var i=this.topStack();this.source.push(i+" = ("+i+" === null || "+i+" === undefined || "+i+" === false ? "+i+" : "+this.nameLookup(i,j,"context")+");")},pushStringParam:function(i){this.pushStack("depth"+this.lastContext);this.pushString(i)},pushString:function(i){this.pushStack(this.quotedString(i))},push:function(i){this.pushStack(i)},invokeMustache:function(k,j,i){this.populateParams(k,this.quotedString(j),"{}",null,i,function(l,n,m){if(!this.usingKnownHelper){this.context.aliases.helperMissing="helpers.helperMissing";this.context.aliases.undef="void 0";this.source.push("else if("+m+"=== undef) { "+l+" = helperMissing.call("+n+"); }");if(l!==m){this.source.push("else { "+l+" = "+m+"; }")}}})},invokeProgram:function(k,l,j){var i=this.programExpression(this.inverse);var m=this.programExpression(k);this.populateParams(l,null,m,i,j,function(n,p,o){if(!this.usingKnownHelper){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";this.source.push("else { "+n+" = blockHelperMissing.call("+p+"); }")}})},populateParams:function(p,k,t,q,x,w){var l=x||this.options.stringParams||q||this.options.data;var j=this.popStack(),v;var n=[],m,o,u;if(l){this.register("tmp1",t);u="tmp1"}else{u="{ hash: {} }"}if(l){var s=(x?this.popStack():"{}");this.source.push("tmp1.hash = "+s+";")}if(this.options.stringParams){this.source.push("tmp1.contexts = [];")}for(var r=0;r<p;r++){m=this.popStack();n.push(m);if(this.options.stringParams){this.source.push("tmp1.contexts.push("+this.popStack()+");")}}if(q){this.source.push("tmp1.fn = tmp1;");this.source.push("tmp1.inverse = "+q+";")}if(this.options.data){this.source.push("tmp1.data = data;")}n.push(u);this.populateCall(n,j,k||j,w,t!=="{}")},populateCall:function(n,j,k,q,o){var m=["depth0"].concat(n).join(", ");var i=["depth0"].concat(k).concat(n).join(", ");var p=this.nextStack();if(this.usingKnownHelper){this.source.push(p+" = "+j+".call("+m+");")}else{this.context.aliases.functionType='"function"';var l=o?"foundHelper && ":"";this.source.push("if("+l+"typeof "+j+" === functionType) { "+p+" = "+j+".call("+m+"); }")}q.call(this,p,i,j);this.usingKnownHelper=false},invokePartial:function(i){params=[this.nameLookup("partials",i,"partial"),"'"+i+"'",this.popStack(),"helpers","partials"];if(this.options.data){params.push("data")}this.pushStack("self.invokePartial("+params.join(", ")+");")},assignToHash:function(i){var j=this.popStack();var k=this.topStack();this.source.push(k+"['"+i+"'] = "+j+";")},compiler:e,compileChildren:function(j,n){var p=j.children,r,q;for(var o=0,k=p.length;o<k;o++){r=p[o];q=new this.compiler();this.context.programs.push("");var m=this.context.programs.length;r.index=m;r.name="program"+m;this.context.programs[m]=q.compile(r,n,this.context)}},programExpression:function(k){if(k==null){return"self.noop"}var p=this.environment.children[k],o=p.depths.list;var n=[p.index,p.name,"data"];for(var m=0,j=o.length;m<j;m++){depth=o[m];if(depth===1){n.push("depth0")}else{n.push("depth"+(depth-1))}}if(o.length===0){return"self.program("+n.join(", ")+")"}else{n.shift();return"self.programWithDepth("+n.join(", ")+")"}},register:function(i,j){this.useRegister(i);this.source.push(i+" = "+j+";")},useRegister:function(i){if(!this.context.registers[i]){this.context.registers[i]=true;this.context.registers.list.push(i)}},pushStack:function(i){this.source.push(this.nextStack()+" = "+i+";");return"stack"+this.stackSlot},nextStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(i){return'"'+i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var a=("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield").split(" ");var d=e.RESERVED_WORDS={};for(var c=0,b=a.length;c<b;c++){d[a[c]]=true}e.isValidJavaScriptVariableName=function(i){if(!e.RESERVED_WORDS[i]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(i)){return true}return false}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);Handlebars.precompile=function(d,c){c=c||{};var b=Handlebars.parse(d);var a=new Handlebars.Compiler().compile(b,c);return new Handlebars.JavaScriptCompiler().compile(a,c)};Handlebars.compile=function(b,a){a=a||{};var d;function c(){var g=Handlebars.parse(b);var f=new Handlebars.Compiler().compile(g,a);var e=new Handlebars.JavaScriptCompiler().compile(f,a,undefined,true);return Handlebars.template(e)}return function(f,e){if(!d){d=c()}return d.call(this,f,e)}};Handlebars.VM={template:function(a){var b={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(d,e,f){var c=this.programs[d];if(f){return Handlebars.VM.program(e,f)}else{if(c){return c}else{c=this.programs[d]=Handlebars.VM.program(e);return c}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(d,c){c=c||{};return a.call(b,Handlebars,d,c.helpers,c.partials,c.data)}},programWithDepth:function(b,d,c){var a=Array.prototype.slice.call(arguments,2);return function(f,e){e=e||{};return b.apply(this,[f,e.data||d].concat(a))}},program:function(a,b){return function(d,c){c=c||{};return a(d,c.data||b)}},noop:function(){return""},invokePartial:function(a,b,d,e,c,f){options={helpers:e,partials:c,data:f};if(a===undefined){throw new Handlebars.Exception("The partial "+b+" could not be found")}else{if(a instanceof Function){return a(d,options)}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+b+" could not be compiled when running in runtime-only mode")}else{c[b]=Handlebars.compile(a);return c[b](d,options)}}}}};Handlebars.template=Handlebars.VM.template; \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/annotations.js --- /dev/null +++ b/static/scripts/packed/mvc/annotations.js @@ -0,0 +1,1 @@ +var Annotation=BaseModel.extend(LoggableMixin).extend({logger:console,toString:function(){return"Annotation()"}});var AnnotationView=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"AnnotationView()"}}); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/base-mvc.js --- /dev/null +++ b/static/scripts/packed/mvc/base-mvc.js @@ -0,0 +1,1 @@ +var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){if(this.model.attributes.hidden){this.$el.hide()}else{this.$el.show()}}});var LoggableMixin={logger:null,log:function(){return(this.logger)?(this.logger.log.apply(this,arguments)):(undefined)}};var TemplateLoader=_.extend({},LoggableMixin,{getTemplateLoadFn:function(){throw ("There is no templateLoadFn. Make sure you're using a subclass of TemplateLoader")},getTemplates:function(d,e){e=e||false;this.log(this,"getTemplates:",d,", forceReload:",e);var c={},a=this,b=this.getTemplateLoadFn();if(!d){return c}jQuery.each(d,function(f,g){jQuery.each(g,function(h,i){a.log(a+", templateFile:",f,"templateName:",h,", templateID:",i);c[h]=b.call(a,f,h,i)})});return c}});var CompiledTemplateLoader=_.extend({},TemplateLoader,{getTemplateLoadFn:function(){return this.loadCompiledHandlebarsTemplate},loadCompiledHandlebarsTemplate:function(b,a,c){this.log("getInDomTemplates, templateFile:",b,"templateName:",a,", templateID:",c);if(!Handlebars.templates||!Handlebars.templates[c]){throw ("Template not found: Handlebars."+c+". Check your h.templates() call in the mako file that rendered this page")}this.log("found template function:",c);return Handlebars.templates[c]}});var InDomTemplateLoader=_.extend({},TemplateLoader,{compileTemplate:function(a){if(!Handlebars||!Handlebars.compile){throw ("No Handlebars.compile found. You may only have Handlebars.runtime loaded.Include handlebars.full for this to work")}this.log("compiling template:",a);return Handlebars.compile(a)},findTemplateInDom:function(b,a,c){return $("script#"+c).last()},getTemplateLoadFn:function(){return this.loadInDomTemplate},loadInDomTemplate:function(b,a,c){this.log("getInDomTemplate, templateFile:",b,"templateName:",a,", templateID:",c);var d=this.findTemplateInDom(b,a,c);if(!d||!d.length){throw ("Template not found within the DOM: "+c+". Check that this template has been included in the page")}this.log("found template in dom:",d.html());return this.compileTemplate(d.html())}});var RemoteTemplateLoader=_.extend({},InDomTemplateLoader,{templateBaseURL:"static/scripts/templates/",getTemplateLoadFn:function(){return this.loadViaHttpGet},loadViaHttpGet:function(d,c,f){var b="static/scripts/templates/";this.log("loadViaHttpGet, templateFile:",d,"templateName:",c,", templateID:",f,"templateBaseURL:",this.templateBaseURL);var h=null;try{h=this.loadInDomTemplate(d,c,f)}catch(g){this.log("getInDomTemplate exception:"+g);if(!Handlebars.compile){throw (g)}this.log("Couldn't locate template in DOM: "+f);var a=this;var e=b+d;jQuery.ajax(e,{method:"GET",async:false,success:function(i){a.log(d+" loaded via GET. Attempting compile...");$("body").append(i);h=a.loadInDomTemplate(d,c,f)},error:function(j,i,k){throw ("Failed to fetch "+e+":"+i)}})}if(!h){throw ("Couldn't load or fetch template: "+f)}return h}}); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/history.js --- a/static/scripts/packed/mvc/history.js +++ b/static/scripts/packed/mvc/history.js @@ -1,1 +1,1 @@ -function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>'),b=this.model.get("for_editing");if(this.model.get("state")!==HistoryItem.STATES.UPLOAD){a.append(this._render_displayButton());if(b){a.append(this._render_editButton())}}if(b){a.append(this._render_deleteButton())}return a},_render_displayButton:function(){displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",icon_class:"display",enabled:false,}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display",});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){var d=this.model.get("id"),c=this.model.get("purged"),a=this.model.get("deleted");var b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b={enabled:false,icon_class:"edit"};b.title=(!c)?("Undelete dataset to edit attributes"):("Cannot edit attributes of datasets removed from disk")}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a=(this.model.get("delete_url"))?({title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"}):({title:"Dataset is already deleted",icon_class:"delete",enabled:false});this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){var b=this.model.get("name"),a=this.model.get("hid");title=(a+": "+b);return $(linkHTMLTemplate({href:"javascript:void(0);",text:'<span class="historyItemTitle">'+title+"</span>"}))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){b.prepend($(linkHTMLTemplate({title:"View or report this error",href:this.model.get("report_errors_url"),target:"galaxy_main",classes:["icon-button","tooltip","bug"]})))}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.templates.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(h){h.append(this._render_hdaSummary());if(this.model.get("misc_info")){h.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var c=$("<div/>");c.append(this._render_downloadLinks());c.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){c.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");c.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var d=$('<div style="float: right;"></div>');d.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));d.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));c.append(d);c.append('<div style="clear: both"></div>');this.tagArea=$('<div class="tag-area" style="display: none">');this.tagArea.append("<strong>Tags:</strong>");this.tagElt=$('<div class="tag-elt"></div>');c.append(this.tagArea.append(this.tagElt));var e=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));this.annotationArea=e;e.append("<strong>Annotation:</strong>");this.annotationElem=$('<div id="'+this.model.get("id")+'-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>');e.append(this.annotationElem);c.append(e)}}c.append('<div style="clear: both;"></div>');h.append(c);var i=$("<div/>");if(this.model.get("display_apps")){var j=this.model.get("display_apps"),b=$("<span/>");for(app_name in j){var g=j[app_name],f=app_name+" ";for(location_name in g){f+=linkHTMLTemplate({text:location_name,href:g[location_name].url,target:g[location_name].target})+" "}b.append(f)}i.append(b)}h.append(i)}else{if(this.model.get("for_editing")){h.append(this._render_showParamsAndRerun())}}h.append(this._render_peek())},_render_body:function(){var b=this.model.get("state"),c=this.model.get("for_editing");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=_.template('<span class="<%= dbkey %>"><%= dbkey %></span>',{dbkey:this.model.get("metadata_dbkey")});if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){a=linkHTMLTemplate({text:this.model.get("metadata_dbkey"),href:this.model.get("edit_url"),target:"galaxy_main"})}return(HistoryItemView.TEMPLATES.hdaSummary(_.extend({dbkeyHTML:a},this.model.attributes)))},_render_showParamsAndRerun:function(){var a=$("<div/>");a.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){a.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})))}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this,".loadAndDisplayTags",b);var c=this.tagArea;var a=this.tagElt;if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){this.log("tag_elt_html:",d);a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this,".loadAndDisplayAnnotation",b);var d=this.annotationArea,c=this.annotationElem,a=this.model.get("ajax_set_annotation_url");this.log("annotationArea hidden:",d.is(":hidden"));this.log("annotationElem html:",c.html());if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.TEMPLATES={};HistoryItemView.TEMPLATES.hdaSummary=_.template(["<%= misc_blurb %><br />",'format: <span class="<%= data_type %>"><%= data_type %></span>, ',"database: <%= dbkeyHTML %>"].join(""));HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"common-templates.html":{warningMsg:"template-warningmessagesmall",},"history-templates.html":{messages:"template-history-warning-messages2",hdaSummary:"template-history-hdaSummary"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});function createMockHistoryData(){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})}; \ No newline at end of file +function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({logger:console,tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.clearReferences();this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},clearReferences:function(){this.displayButton=null;this.editButton=null;this.deleteButton=null;this.errButton=null},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());a.append(this._render_editButton());a.append(this._render_deleteButton());return a},_render_displayButton:function(){if(this.model.get("state")===HistoryItem.STATES.UPLOAD){return null}displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",enabled:false,icon_class:"display",}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display",});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){if((this.model.get("state")===HistoryItem.STATES.UPLOAD)||(!this.model.get("for_editing"))){return null}var c=this.model.get("purged"),a=this.model.get("deleted"),b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b.enabled=false}if(a){b.title="Undelete dataset to edit attributes"}else{if(c){b.title="Cannot edit attributes of datasets removed from disk"}}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a=(this.model.get("delete_url"))?({title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"}):({title:"Dataset is already deleted",icon_class:"delete",enabled:false});this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){this.log("model:",this.model.toJSON());return $(jQuery.trim(HistoryItemView.templates.titleLink(this.model.toJSON())))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){this.errButton=new IconButtonView({model:new IconButton({title:"View or report this error",href:this.model.get("report_error_url"),target:"galaxy_main",icon_class:"bug"})});b.prepend(this.errButton.render().$el)}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.templates.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(h){h.append(this._render_hdaSummary());if(this.model.get("misc_info")){h.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var c=$("<div/>");c.append(this._render_downloadLinks());c.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){c.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");c.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var d=$('<div style="float: right;"></div>');d.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));d.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));c.append(d);c.append('<div style="clear: both"></div>');this.tagArea=$('<div class="tag-area" style="display: none">');this.tagArea.append("<strong>Tags:</strong>");this.tagElt=$('<div class="tag-elt"></div>');c.append(this.tagArea.append(this.tagElt));var e=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));this.annotationArea=e;e.append("<strong>Annotation:</strong>");this.annotationElem=$('<div id="'+this.model.get("id")+'-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>');e.append(this.annotationElem);c.append(e)}}c.append('<div style="clear: both;"></div>');h.append(c);var i=$("<div/>");if(this.model.get("display_apps")){var j=this.model.get("display_apps"),b=$("<span/>");for(app_name in j){var g=j[app_name],f=app_name+" ";for(location_name in g){f+=linkHTMLTemplate({text:location_name,href:g[location_name].url,target:g[location_name].target})+" "}b.append(f)}i.append(b)}h.append(i)}else{if(this.model.get("for_editing")){h.append(this._render_showParamsAndRerun())}}h.append(this._render_peek())},_render_body:function(){var b=this.model.get("state"),c=this.model.get("for_editing");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=this.model.toJSON();if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){_.extend(a,{dbkey_unknown_and_editable:true})}return HistoryItemView.templates.hdaSummary(a)},_render_showParamsAndRerun:function(){var a=$("<div/>");this.showParamsButton=new IconButtonView({model:new IconButton({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",icon_class:"information"})});a.append(this.showParamsButton.render().$el);if(this.model.get("for_editing")){this.rerunButton=new IconButtonView({model:new IconButton({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",icon_class:"arrow-circle"})})}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this,".loadAndDisplayTags",b);var c=this.tagArea;var a=this.tagElt;if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){this.log("tag_elt_html:",d);a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this,".loadAndDisplayAnnotation",b);var d=this.annotationArea,c=this.annotationElem,a=this.model.get("ajax_set_annotation_url");this.log("annotationArea hidden:",d.is(":hidden"));this.log("annotationElem html:",c.html());if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"history-templates.html":{messages:"template-history-warning-messages",titleLink:"template-history-titleLink",hdaSummary:"template-history-hdaSummary"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});function createMockHistoryData(){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR,report_error_url:"example.com/report_err"}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})}; \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/tags.js --- /dev/null +++ b/static/scripts/packed/mvc/tags.js @@ -0,0 +1,1 @@ +var Tag=BaseModel.extend(LoggableMixin).extend({logger:console,defaults:{id:null,itemClass:null},toString:function(){return"Tag()"}});var TagView=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"TagView()"}});var TagCollection=Backbone.Collection.extend(LoggableMixin).extend({model:Tag,logger:console,toString:function(){return"TagCollection()"}});var TagList=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"TagList()"}}); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/helpers-common-templates.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/helpers-common-templates.js @@ -0,0 +1,1 @@ +Handlebars.registerPartial("clearFloatDiv",function(a){return'<div class="clear"></div>'});Handlebars.registerPartial("iconButton",function(c,b){var a="";a+=(c.enabled)?("<a"):("<span");if(c.title){c.buffer+=' title="'+c.title+'"'}a+=' class="icon-button';if(c.isMenuButton){a+=" menu-button"}if(c.title){a+=" tooltip"}a+=" "+c.icon_class;if(!c.enabled){a+="_disabled"}a+='"';if(c.id){a+=' id="'+c.id+'"'}a+=' href="'+((c.href)?(c.href):("javascript:void(0);"))+'"';if(c.target){a+=' target="'+c.target+'"'}if(!c.visible){a+=' style="display: none;"'}a+=">Bler"+((c.enabled)?("</a>"):("</span>"));return a});Handlebars.registerHelper("warningmessagesmall",function(a){return'<div class="warningmessagesmall"><strong>'+a.fn(this)+"</strong></div>"}); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-hdaSummary.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/template-history-hdaSummary.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-hdaSummary"]=b(function(g,n,f,m,l){f=f||g.helpers;var j="",d,i,h="function",k=this.escapeExpression,o=this;function e(t,s){var q="",r,p;q+='\n <a href="';p=f.edit_url;if(p){r=p.call(t,{hash:{}})}else{r=t.edit_url;r=typeof r===h?r():r}q+=k(r)+'" target="galaxy_main">';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+"</a>\n";return q}function c(t,s){var q="",r,p;q+='\n <span class="';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+'">';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+"</span>\n";return q}i=f.misc_blurb;if(i){d=i.call(n,{hash:{}})}else{d=n.misc_blurb;d=typeof d===h?d():d}j+=k(d)+'<br />\nformat: <span class="';i=f.data_type;if(i){d=i.call(n,{hash:{}})}else{d=n.data_type;d=typeof d===h?d():d}j+=k(d)+'">';i=f.data_type;if(i){d=i.call(n,{hash:{}})}else{d=n.data_type;d=typeof d===h?d():d}j+=k(d)+"</span>,\ndatabase:\n";d=n.dbkey_unknown_and_editable;d=f["if"].call(n,d,{hash:{},inverse:o.program(3,c,l),fn:o.program(1,e,l)});if(d||d===0){j+=d}return j})})(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-titleLink.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/template-history-titleLink.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-titleLink"]=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+='<a href="javascript:void(0);"><span class="historyItemTitle">';g=d.hid;if(g){c=g.call(l,{hash:{}})}else{c=l.hid;c=typeof c===f?c():c}h+=i(c)+": ";g=d.name;if(g){c=g.call(l,{hash:{}})}else{c=l.name;c=typeof c===f?c():c}h+=i(c)+"</span></a>";return h})})(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-warning-messages.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/template-history-warning-messages.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-warning-messages"]=b(function(g,s,q,k,v){q=q||g.helpers;var r="",h,e="function",d=this.escapeExpression,p=this,c=q.blockHelperMissing;function o(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(2,n,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(2,n,y)})}if(x||x===0){return x}else{return""}}function n(z,y){var w="",x;w+="\n This dataset has been deleted.\n ";x=z.undelete_url;x=q["if"].call(z,x,{hash:{},inverse:p.noop,fn:p.program(3,m,y)});if(x||x===0){w+=x}w+="\n";return w}function m(A,z){var x="",y,w;x+='\n Click <a href="';w=q.undelete_url;if(w){y=w.call(A,{hash:{}})}else{y=A.undelete_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemUndelete" id="historyItemUndeleter-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to undelete it\n ';y=A.purge_url;y=q["if"].call(A,y,{hash:{},inverse:p.noop,fn:p.program(4,l,z)});if(y||y===0){x+=y}x+="\n ";return x}function l(A,z){var x="",y,w;x+='\n or <a href="';w=q.purge_url;if(w){y=w.call(A,{hash:{}})}else{y=A.purge_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemPurge" id="historyItemPurger-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to immediately remove it from disk\n ';return x}function j(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(7,i,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(7,i,y)})}if(x||x===0){return x}else{return""}}function i(x,w){return"\n This dataset has been deleted and removed from disk.\n"}function f(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(10,u,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(10,u,y)})}if(x||x===0){return x}else{return""}}function u(z,y){var w="",x;w+="\n This dataset has been hidden.\n ";x=z.undelete_url;x=q["if"].call(z,x,{hash:{},inverse:p.noop,fn:p.program(11,t,y)});if(x||x===0){w+=x}w+="\n";return w}function t(A,z){var x="",y,w;x+='\n Click <a href="';w=q.unhide_url;if(w){y=w.call(A,{hash:{}})}else{y=A.unhide_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemUnhide" id="historyItemUnhider-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to unhide it\n ';return x}h=s.deleted;h=q["if"].call(s,h,{hash:{},inverse:p.noop,fn:p.program(1,o,v)});if(h||h===0){r+=h}r+="\n\n";h=s.purged;h=q["if"].call(s,h,{hash:{},inverse:p.noop,fn:p.program(6,j,v)});if(h||h===0){r+=h}r+="\n\n";h=s.visible;h=q.unless.call(s,h,{hash:{},inverse:p.noop,fn:p.program(9,f,v)});if(h||h===0){r+=h}return r})})(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-warningmessagesmall.js --- /dev/null +++ b/static/scripts/packed/templates/compiled/template-warningmessagesmall.js @@ -0,0 +1,1 @@ +(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-warningmessagesmall"]=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+=' \n <div class="warningmessagesmall"><strong>';g=d.warning;if(g){c=g.call(l,{hash:{}})}else{c=l.warning;c=typeof c===f?c():c}h+=i(c)+"</strong></div>";return h})})(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/viz/circster.js --- a/static/scripts/packed/viz/circster.js +++ b/static/scripts/packed/viz/circster.js @@ -1,1 +1,1 @@ -define(["libs/d3","viz/visualization"],function(d,e){var c=function(){this.initialize&&this.initialize.apply(this,arguments)};c.extend=Backbone.Model.extend;var b=Backbone.View.extend({className:"circster",initialize:function(h){this.total_gap=h.total_gap;this.genome=h.genome;this.dataset_arc_height=h.dataset_arc_height;this.track_gap=5},render:function(){var j=this,l=this.dataset_arc_height,m=j.$el.width(),h=j.$el.height(),k=(Math.min(m,h)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var i=d.select(j.$el[0]).append("svg").attr("width",m).attr("height",h).attr("pointer-events","all").append("svg:g").call(d.behavior.zoom().on("zoom",function(){i.attr("transform","translate("+d.event.translate+") scale("+d.event.scale+")")})).attr("transform","translate("+m/2+","+h/2+")").append("svg:g");this.model.get("tracks").each(function(n,p){var q=n.get("genome_wide_data"),r=k+p*(l+j.track_gap),o=(q instanceof e.GenomeWideBigWigData?f:CircsterSummaryTreeTrackRenderer);track_renderer=new o({track:n,radius_start:r,radius_end:r+l,genome:j.genome,total_gap:j.total_gap});track_renderer.render(i)})}});var a=c.extend({initialize:function(h){this.options=h},render:function(i){genome_arcs=this.chroms_layout(),chroms_arcs=this.genome_data_layout();var n=this.options.radius_start,l=this.options.radius_end,o=i.append("g").attr("id","inner-arc"),m=d.svg.arc().innerRadius(n).outerRadius(l),h=o.selectAll("#inner-arc>path").data(genome_arcs).enter().append("path").attr("d",m).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(p){return p.data.chrom});var j=this.options.track.get("prefs"),k=j.block_color;_.each(chroms_arcs,function(p){if(!p){return}var s=i.append("g"),r=d.svg.arc().innerRadius(n),q=s.selectAll("path").data(p).enter();q.append("path").attr("d",r).style("stroke",k)})},chroms_layout:function(){var i=this.options.genome.get_chroms_info(),k=d.layout.pie().value(function(m){return m.len}).sort(null),l=k(i),h=this.options.total_gap/i.length,j=_.map(l,function(o,n){var m=o.endAngle-h;o.endAngle=(m>o.startAngle?m:o.startAngle);return o});return j},chrom_data_layout:function(k,j,i,l,h){},genome_data_layout:function(){var i=this,h=this.chroms_layout(),m=this.options.track.get("genome_wide_data"),l=this.options.radius_start,j=this.options.radius_end,k=_.zip(h,m.get("data")),n=_.map(k,function(p){var q=p[0],o=p[1];return i.chrom_data_layout(q,o,l,j,m.get("min"),m.get("max"))});return n}});var g=a.extend({chrom_data_layout:function(r,i,o,n,k,p){if(!i||typeof i==="string"){return null}var l=i[0],q=i[3],j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s){return q}).startAngle(r.startAngle).endAngle(r.endAngle),h=m(l);_.each(l,function(s,t){h[t].outerRadius=j(s[1])});return h}});var f=a.extend({chrom_data_layout:function(q,i,o,n,k,p){var l=i.data;if(l.length===0){return}var j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s,r){if(r+1===l.length){return 0}return l[r+1][0]-l[r][0]}).startAngle(q.startAngle).endAngle(q.endAngle),h=m(l);_.each(l,function(r,s){h[s].outerRadius=j(r[1])});return h}});return{CircsterView:b}}); \ No newline at end of file +define(["libs/d3","viz/visualization"],function(e,f){var d=function(){this.initialize&&this.initialize.apply(this,arguments)};d.extend=Backbone.Model.extend;var c=Backbone.View.extend({className:"circster",initialize:function(h){this.total_gap=h.total_gap;this.genome=h.genome;this.dataset_arc_height=h.dataset_arc_height;this.track_gap=5},render:function(){var j=this,l=this.dataset_arc_height,m=j.$el.width(),h=j.$el.height(),k=(Math.min(m,h)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var i=e.select(j.$el[0]).append("svg").attr("width",m).attr("height",h).attr("pointer-events","all").append("svg:g").call(e.behavior.zoom().on("zoom",function(){i.attr("transform","translate("+e.event.translate+") scale("+e.event.scale+")")})).attr("transform","translate("+m/2+","+h/2+")").append("svg:g");this.model.get("tracks").each(function(n,p){var q=n.get("genome_wide_data"),s=k+p*(l+j.track_gap),o=(q instanceof f.GenomeWideBigWigData?g:a);var r=new o({track:n,radius_start:s,radius_end:s+l,genome:j.genome,total_gap:j.total_gap});r.render(i)})}});var b=d.extend({initialize:function(h){this.options=h},render:function(m){var h=this.chroms_layout(),k=this.genome_data_layout();var n=this.options.radius_start,j=this.options.radius_end,p=m.append("g").attr("id","inner-arc"),o=e.svg.arc().innerRadius(n).outerRadius(j),i=p.selectAll("#inner-arc>path").data(h).enter().append("path").attr("d",o).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(r){return r.data.chrom});var q=this.options.track.get("prefs"),l=q.block_color;_.each(k,function(r){if(!r){return}var u=m.append("g"),t=e.svg.arc().innerRadius(n),s=u.selectAll("path").data(r).enter();s.append("path").attr("d",t).style("stroke",l)})},chroms_layout:function(){var i=this.options.genome.get_chroms_info(),k=e.layout.pie().value(function(m){return m.len}).sort(null),l=k(i),h=this.options.total_gap/i.length,j=_.map(l,function(o,n){var m=o.endAngle-h;o.endAngle=(m>o.startAngle?m:o.startAngle);return o});return j},chrom_data_layout:function(k,j,i,l,h){},genome_data_layout:function(){var i=this,h=this.chroms_layout(),m=this.options.track.get("genome_wide_data"),l=this.options.radius_start,j=this.options.radius_end,k=_.zip(h,m.get("data")),n=_.map(k,function(p){var q=p[0],o=p[1];return i.chrom_data_layout(q,o,l,j,m.get("min"),m.get("max"))});return n}});var a=b.extend({chrom_data_layout:function(r,i,o,n,k,p){if(!i||typeof i==="string"){return null}var l=i[0],q=i[3],j=e.scale.linear().domain([k,p]).range([o,n]),m=e.layout.pie().value(function(s){return q}).startAngle(r.startAngle).endAngle(r.endAngle),h=m(l);_.each(l,function(s,t){h[t].outerRadius=j(s[1])});return h}});var g=b.extend({chrom_data_layout:function(q,i,o,n,k,p){var l=i.data;if(l.length===0){return}var j=e.scale.linear().domain([k,p]).range([o,n]),m=e.layout.pie().value(function(s,r){if(r+1===l.length){return 0}return l[r+1][0]-l[r][0]}).startAngle(q.startAngle).endAngle(q.endAngle),h=m(l);_.each(l,function(r,s){h[s].outerRadius=j(r[1])});return h}});return{CircsterView:c}}); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/viz/visualization.js --- a/static/scripts/packed/viz/visualization.js +++ b/static/scripts/packed/viz/visualization.js @@ -1,1 +1,1 @@ -var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},search_features:function(a){var b=this.get("dataset"),c={query:a,dataset_id:b.id,hda_ldda:b.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),c)},load_data:function(j,h,b,g){var d={chrom:j.get("chrom"),low:j.get("start"),high:j.get("end"),mode:h,resolution:b},e=this.get("dataset");if(e){d.dataset_id=e.id;d.hda_ldda=e.get("hda_ldda")}$.extend(d,g);var k=this.get("filters_manager");if(k){var l=[];var a=k.filters;for(var f=0;f<a.length;f++){l.push(a[f].name)}d.filter_cols=JSON.stringify(l)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(j,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var GenomeWideBigWigData=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.flatten(_.map(this.get("data"),function(c){if(c.data.length!==0){return _.map(c.data,function(d){return d[1]})}else{return 0}}));this.set("max",_.max(a));this.set("min",_.min(a))}});var GenomeWideSummaryTreeData=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.max(this.get("data"),function(c){if(!c||typeof c==="string"){return 0}return c[1]});this.attributes.max=(a&&typeof a!=="string"?a[1]:0)}});var BackboneTrack=Dataset.extend({initialize:function(a){this.set("id",a.dataset_id);var c=this.get("genome_wide_data");if(c){var b=(this.get("track_type")==="LineTrack"?GenomeWideBigWigData:GenomeWideSummaryTreeData);this.set("genome_wide_data",new b(c))}}});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:"BackboneTrack"}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var GenomeVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{bookmarks:null,viewport:null})});var TrackConfig=Backbone.Model.extend({});var CircsterDataLayout=Backbone.Model.extend({defaults:{genome:null,dataset:null,total_gap:null},chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(d,c,b,e,a){},genome_data_layout:function(){var b=this,a=this.chroms_layout(),f=this.get("track").get("genome_wide_data"),e=this.get("radius_start"),c=this.get("radius_end"),d=_.zip(a,f.get("data")),g=_.map(d,function(i){var j=i[0],h=i[1];return b.chrom_data_layout(j,h,e,c,f.get("min"),f.get("max"))});return g}});var CircsterSummaryTreeLayout=CircsterDataLayout.extend({chrom_data_layout:function(k,b,h,g,d,i){if(!b||typeof b==="string"){return null}var e=b[0],j=b[3],c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l){return j}).startAngle(k.startAngle).endAngle(k.endAngle),a=f(e);_.each(e,function(l,m){a[m].outerRadius=c(l[1])});return a}});var CircsterBigWigLayout=CircsterDataLayout.extend({chrom_data_layout:function(j,b,h,g,d,i){var e=b.data;if(e.length===0){return}var c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l,k){if(k+1===e.length){return 0}return e[k+1][0]-e[k][0]}).startAngle(j.startAngle).endAngle(j.endAngle),a=f(e);_.each(e,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.total_gap=a.total_gap;this.genome=a.genome;this.dataset_arc_height=a.dataset_arc_height;this.track_gap=5},render:function(){var c=this,e=this.dataset_arc_height,f=c.$el.width(),a=c.$el.height(),d=(Math.min(f,a)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var b=d3.select(c.$el[0]).append("svg").attr("width",f).attr("height",a).attr("pointer-events","all").append("svg:g").call(d3.behavior.zoom().on("zoom",function(){b.attr("transform","translate("+d3.event.translate+") scale("+d3.event.scale+")")})).attr("transform","translate("+f/2+","+a/2+")").append("svg:g");this.model.get("tracks").each(function(i,o){var j=i.get("genome_wide_data"),n=d+o*(e+c.track_gap),k=(j instanceof GenomeWideBigWigData?CircsterBigWigLayout:CircsterSummaryTreeLayout),q=new k({track:i,radius_start:n,radius_end:n+e,genome:c.genome,total_gap:c.total_gap}),g=q.chroms_layout(),l=q.genome_data_layout();var r=b.append("g").attr("id","inner-arc"),p=d3.svg.arc().innerRadius(n).outerRadius(n+e),h=r.selectAll("#inner-arc>path").data(g).enter().append("path").attr("d",p).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(t){return t.data.chrom});var s=i.get("prefs"),m=s.block_color;_.each(l,function(t){if(!t){return}var w=b.append("g"),v=d3.svg.arc().innerRadius(n),u=w.selectAll("path").data(t).enter().append("path").attr("d",v).style("stroke",m).style("fill",m)})})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})}; \ No newline at end of file +(function(){var f=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(t){return true}},go:function(){var w=$.Deferred(),v=this,y=v.get("ajax_settings"),x=v.get("success_fn"),u=v.get("interval"),t=function(){$.ajax(y).success(function(z){if(x(z)){w.resolve(z)}else{setTimeout(t,u)}})};t();return w}});var g=function(t){this.default_font=t!==undefined?t:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(g.prototype,{load_pattern:function(t,x){var u=this.patterns,v=this.dummy_context,w=new Image();w.src=galaxy_paths.attributes.image_path+x;w.onload=function(){u[t]=v.createPattern(w,"repeat")}},get_pattern:function(t){return this.patterns[t]},new_canvas:function(){var t=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(t)}t.manager=this;return t}});var p=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(t){this.clear()},get_elt:function(u){var v=this.attributes.obj_cache,w=this.attributes.key_ary,t=w.indexOf(u);if(t!==-1){if(v[u].stale){w.splice(t,1);delete v[u]}else{this.move_key_to_end(u,t)}}return v[u]},set_elt:function(u,w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=this.attributes.num_elements;if(!x[u]){if(y.length>=v){var t=y.shift();delete x[t]}y.push(u)}x[u]=w;return w},move_key_to_end:function(u,t){this.attributes.key_ary.splice(t,1);this.attributes.key_ary.push(u)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var d=p.extend({defaults:_.extend({},p.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(t,u){return true},can_subset:function(t){return false}}),data_is_ready:function(){var v=this.get("dataset"),u=$.Deferred(),t=new f({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:v.id,hda_ldda:v.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(w){return w!=="pending"}});$.when(t.go()).then(function(w){u.resolve(w==="ok"||w==="data")});return u},search_features:function(t){var u=this.get("dataset"),v={query:t,dataset_id:u.id,hda_ldda:u.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),v)},load_data:function(B,A,u,z){var w={chrom:B.get("chrom"),low:B.get("start"),high:B.get("end"),mode:A,resolution:u},x=this.get("dataset");if(x){w.dataset_id=x.id;w.hda_ldda=x.get("hda_ldda")}$.extend(w,z);var C=this.get("filters_manager");if(C){var D=[];var t=C.filters;for(var y=0;y<t.length;y++){D.push(t[y].name)}w.filter_cols=JSON.stringify(D)}var v=this;return $.getJSON(this.get("data_url"),w,function(E){v.set_data(B,E)})},get_data:function(z,y,v,x){var A=this.get_elt(z);if(A&&(is_deferred(A)||this.get("data_mode_compatible")(A,y))){return A}var B=this.get("key_ary"),u=this.get("obj_cache"),C,t;for(var w=0;w<B.length;w++){C=B[w];t=new h({from_str:C});if(t.contains(z)){A=u[C];if(is_deferred(A)||(this.get("data_mode_compatible")(A,y)&&this.get("can_subset")(A))){this.move_key_to_end(C,w);return A}}}A=this.load_data(z,y,v,x);this.set_data(z,A);return A},set_data:function(u,t){this.set_elt(u,t)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(B,A,w,z,x){var D=this.get_elt(B);if(!(D&&this.get("data_mode_compatible")(D,A))){console.log("ERROR: no current data for: ",dataset,B.toString(),A,w,z);return}D.stale=true;var v=B.get("start");if(x===this.DEEP_DATA_REQ){$.extend(z,{start_val:D.data.length+1})}else{if(x===this.BROAD_DATA_REQ){v=(D.max_high?D.max_high:D.data[D.data.length-1][2])+1}}var C=B.copy().set("start",v);var u=this,y=this.load_data(C,A,w,z),t=$.Deferred();this.set_data(B,t);$.when(y).then(function(E){if(E.data){E.data=D.data.concat(E.data);if(E.max_low){E.max_low=D.max_low}if(E.message){E.message=E.message.replace(/[0-9]+/,E.data.length)}}u.set_data(B,E);t.resolve(E)});return t},get_elt:function(t){return p.prototype.get_elt.call(this,t.toString())},set_elt:function(u,t){return p.prototype.set_elt.call(this,u.toString(),t)}});var n=d.extend({load_data:function(t,w,x,u,v){if(u>1){return{data:null}}return d.prototype.load_data.call(this,t,w,x,u,v)}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var h=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(u){if(u.from_str){var w=u.from_str.split(":"),v=w[0],t=w[1].split("-");this.set({chrom:v,start:parseInt(t[0],10),end:parseInt(t[1],10)})}},copy:function(){return new h({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(A){var u=this.get("chrom"),z=A.get("chrom"),y=this.get("start"),w=A.get("start"),x=this.get("end"),v=A.get("end"),t;if(u&&z&&u!==z){return this.get("DIF_CHROMS")}if(y<w){if(x<w){t=this.get("BEFORE")}else{if(x<=v){t=this.get("OVERLAP_START")}else{t=this.get("CONTAINS")}}}else{if(y>v){t=this.get("AFTER")}else{if(x<=v){t=this.get("CONTAINED_BY")}else{t=this.get("OVERLAP_END")}}}return t},contains:function(t){return this.compute_overlap(t)===this.get("CONTAINS")},overlaps:function(t){return _.intersection([this.compute_overlap(t)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var l=Backbone.Collection.extend({model:h});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:h}]});var q=Backbone.Collection.extend({model:e});var b=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(u){var t=_.flatten(_.map(this.get("data"),function(v){if(v.data.length!==0){return _.map(v.data,function(w){return w[1]})}else{return 0}}));this.set("max",_.max(t));this.set("min",_.min(t))}});var m=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(u){var t=_.max(this.get("data"),function(v){if(!v||typeof v==="string"){return 0}return v[1]});this.attributes.max=(t&&typeof t!=="string"?t[1]:0)}});var s=Dataset.extend({initialize:function(t){this.set("id",t.dataset_id);var v=this.get("genome_wide_data");if(v){var u=(this.get("track_type")==="LineTrack"?b:m);this.set("genome_wide_data",new u(v))}}});var o=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:s}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=o.extend({defaults:_.extend({},o.prototype.defaults,{bookmarks:null,viewport:null})});var a=Backbone.Model.extend({});var i=Backbone.Router.extend({initialize:function(u){this.view=u.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var t=this;t.view.on("navigate",function(v){t.navigate(v)})},change_location:function(t){this.view.go_to(t)}});var j=function(t,v,u){$.ajax({url:t,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(w){show_modal("Select datasets for new tracks",w,{Cancel:function(){hide_modal()},Add:function(){var x=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var y,z=$(this).val();if($(this).attr("name")==="id"){y={hda_id:z}}else{y={ldda_id:z}}x[x.length]=$.ajax({url:v,data:y,dataType:"json"})});$.when.apply($,x).then(function(){var y=(arguments[0] instanceof Array?$.map(arguments,function(z){return z[0]}):[arguments[0]]);u(y)});hide_modal()}})}})};var r=(function(){if(typeof module!=="undefined"&&module.exports){return module.exports}else{if(typeof define==="function"&&define.amd){r={};define(function(){return r});return r}else{return window}}})();r.BrowserBookmark=e;r.BrowserBookmarkCollection=q;r.Cache=p;r.CanvasManager=g;r.Genome=c;r.GenomeDataManager=d;r.GenomeRegion=h;r.GenomeRegionCollection=l;r.GenomeVisualization=k;r.GenomeWideBigWigData=b;r.GenomeWideSummaryTreeData=m;r.ReferenceTrackDataManager=n;r.ServerStateDeferred=f;r.TrackBrowserRouter=i;r.TrackConfig=a;r.Visualization=o;r.add_datasets=j}).call(this); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/common-templates.html --- a/static/scripts/templates/common-templates.html +++ b/static/scripts/templates/common-templates.html @@ -1,3 +1,50 @@ +<script type="text/javascript" class="helper-common" id="helper-clearFloatDiv"> +/** Hack div to clear re-enclose float'd elements above it in the parent div + */ +Handlebars.registerPartial( 'clearFloatDiv', function( options ){ + return '<div class="clear"></div>'; +}); +</script> + +<script type="text/javascript" class="helper-common" id="helper-warningmessagesmall"> +/** Renders a warning in a (mostly css) highlighted, iconned warning box + */ +Handlebars.registerHelper( 'warningmessagesmall', function( options ){ + return '<div class="warningmessagesmall"><strong>' + options.fn( this ) + '</strong></div>' +}); +</script> + <script type="text/template" class="template-common" id="template-warningmessagesmall"> - <div class=warningmessagesmall><strong>{{{warning}}}</strong></div> +{{! renders a warning in a (mostly css) highlighted, iconned warning box }} + <div class="warningmessagesmall"><strong>{{ warning }}</strong></div></script> + +<script type="text/javascript" class="helper-common" id="helper-iconButton"> +/** Renders a glx style icon-button (see IconButton in mvc/ui.js) + * can be used in either of the following ways: + * within a template: {{> iconButton buttonData}} + * from js: var templated = ( Handlebars.partials.iconButton( buttonData ) ); + */ +Handlebars.registerPartial( 'iconButton', function( buttonData, options ){ + var buffer = ""; + buffer += ( buttonData.enabled )?( '<a' ):( '<span' ); + + if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; } + + buffer += ' class="icon-button'; + if( buttonData.isMenuButton ){ buffer += ' menu-button'; } + if( buttonData.title ){ buffer += ' tooltip'; } + buffer += ' ' + buttonData.icon_class; + if( !buttonData.enabled ){ buffer += '_disabled'; } + buffer += '"'; + + if( buttonData.id ){ buffer += ' id="' + buttonData.id + '"'; } + buffer += ' href="' + ( ( buttonData.href )?( buttonData.href ):( 'javascript:void(0);' ) ) + '"'; + if( buttonData.target ){ buffer += ' target="' + buttonData.target + '"'; } + + if( !buttonData.visible ){ buffer += ' style="display: none;"'; } + + buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); + return buffer; +}); +</script> diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/helpers-common-templates.js --- /dev/null +++ b/static/scripts/templates/compiled/helpers-common-templates.js @@ -0,0 +1,37 @@ +/** Hack div to clear re-enclose float'd elements above it in the parent div + */ +Handlebars.registerPartial( 'clearFloatDiv', function( options ){ + return '<div class="clear"></div>'; +}); +/** Renders a glx style icon-button (see IconButton in mvc/ui.js) + * can be used in either of the following ways: + * within a template: {{> iconButton buttonData}} + * from js: var templated = ( Handlebars.partials.iconButton( buttonData ) ); + */ +Handlebars.registerPartial( 'iconButton', function( buttonData, options ){ + var buffer = ""; + buffer += ( buttonData.enabled )?( '<a' ):( '<span' ); + + if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; } + + buffer += ' class="icon-button'; + if( buttonData.isMenuButton ){ buffer += ' menu-button'; } + if( buttonData.title ){ buffer += ' tooltip'; } + buffer += ' ' + buttonData.icon_class; + if( !buttonData.enabled ){ buffer += '_disabled'; } + buffer += '"'; + + if( buttonData.id ){ buffer += ' id="' + buttonData.id + '"'; } + buffer += ' href="' + ( ( buttonData.href )?( buttonData.href ):( 'javascript:void(0);' ) ) + '"'; + if( buttonData.target ){ buffer += ' target="' + buttonData.target + '"'; } + + if( !buttonData.visible ){ buffer += ' style="display: none;"'; } + + buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); + return buffer; +}); +/** Renders a warning in a (mostly css) highlighted, iconned warning box + */ +Handlebars.registerHelper( 'warningmessagesmall', function( options ){ + return '<div class="warningmessagesmall"><strong>' + options.fn( this ) + '</strong></div>' +}); diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-hdaSummary.js --- a/static/scripts/templates/compiled/template-history-hdaSummary.js +++ b/static/scripts/templates/compiled/template-history-hdaSummary.js @@ -2,8 +2,35 @@ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['template-history-hdaSummary'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression; + var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, self=this; +function program1(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n <a href=\""; + foundHelper = helpers.edit_url; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.edit_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\" target=\"galaxy_main\">"; + foundHelper = helpers.metadata_dbkey; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</a>\n"; + return buffer;} + +function program3(depth0,data) { + + var buffer = "", stack1, foundHelper; + buffer += "\n <span class=\""; + foundHelper = helpers.metadata_dbkey; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "\">"; + foundHelper = helpers.metadata_dbkey; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</span>\n"; + return buffer;} foundHelper = helpers.misc_blurb; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } @@ -16,10 +43,9 @@ foundHelper = helpers.data_type; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.data_type; stack1 = typeof stack1 === functionType ? stack1() : stack1; } - buffer += escapeExpression(stack1) + "</span>, ',\ndatabase: "; - foundHelper = helpers.dbkeyHTML; - if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } - else { stack1 = depth0.dbkeyHTML; stack1 = typeof stack1 === functionType ? stack1() : stack1; } - buffer += escapeExpression(stack1); + buffer += escapeExpression(stack1) + "</span>,\ndatabase:\n"; + stack1 = depth0.dbkey_unknown_and_editable; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } return buffer;}); })(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-titleLink.js --- /dev/null +++ b/static/scripts/templates/compiled/template-history-titleLink.js @@ -0,0 +1,18 @@ +(function() { + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['template-history-titleLink'] = template(function (Handlebars,depth0,helpers,partials,data) { + helpers = helpers || Handlebars.helpers; + var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression; + + + buffer += "<a href=\"javascript:void(0);\"><span class=\"historyItemTitle\">"; + foundHelper = helpers.hid; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.hid; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + ": "; + foundHelper = helpers.name; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } + else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + buffer += escapeExpression(stack1) + "</span></a>"; + return buffer;}); +})(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-warning-messages.js --- a/static/scripts/templates/compiled/template-history-warning-messages.js +++ b/static/scripts/templates/compiled/template-history-warning-messages.js @@ -2,21 +2,30 @@ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['template-history-warning-messages'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; + var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing; function program1(depth0,data) { - var buffer = "", stack1; - buffer += "\n<div class=warningmessagesmall><strong>\nThis dataset has been deleted.\n "; - stack1 = depth0.undelete_url; - stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n</strong></div>\n"; - return buffer;} + var stack1, foundHelper; + foundHelper = helpers.warningmessagesmall; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)}); } + else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)}); } + if(stack1 || stack1 === 0) { return stack1; } + else { return ''; }} function program2(depth0,data) { + var buffer = "", stack1; + buffer += "\n This dataset has been deleted.\n "; + stack1 = depth0.undelete_url; + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "\n"; + return buffer;} +function program3(depth0,data) { + var buffer = "", stack1, foundHelper; - buffer += "\n Click <a href=\""; + buffer += "\n Click <a href=\""; foundHelper = helpers.undelete_url; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.undelete_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; } @@ -24,16 +33,16 @@ foundHelper = helpers.id; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; } - buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to undelete it\n "; + buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to undelete it\n "; stack1 = depth0.purge_url; - stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)}); + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(4, program4, data)}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n "; return buffer;} -function program3(depth0,data) { +function program4(depth0,data) { var buffer = "", stack1, foundHelper; - buffer += "\n or\n <a href=\""; + buffer += "\n or <a href=\""; foundHelper = helpers.purge_url; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.purge_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; } @@ -44,24 +53,42 @@ buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to immediately remove it from disk\n "; return buffer;} -function program5(depth0,data) { +function program6(depth0,data) { - - return "\n<div class=warningmessagesmall><strong>\nThis dataset has been deleted and removed from disk.\n</strong></div>\n";} - + var stack1, foundHelper; + foundHelper = helpers.warningmessagesmall; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); } + else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); } + if(stack1 || stack1 === 0) { return stack1; } + else { return ''; }} function program7(depth0,data) { + + return "\n This dataset has been deleted and removed from disk.\n";} + +function program9(depth0,data) { + + var stack1, foundHelper; + foundHelper = helpers.warningmessagesmall; + if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); } + else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; } + if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); } + if(stack1 || stack1 === 0) { return stack1; } + else { return ''; }} +function program10(depth0,data) { + var buffer = "", stack1; - buffer += "\n<div class=warningmessagesmall><strong>\nThis dataset has been hidden.\n "; + buffer += "\n This dataset has been hidden.\n "; stack1 = depth0.undelete_url; - stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)}); + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(11, program11, data)}); if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n</strong></div>\n"; + buffer += "\n"; return buffer;} -function program8(depth0,data) { +function program11(depth0,data) { var buffer = "", stack1, foundHelper; - buffer += "\n Click <a href=\""; + buffer += "\n Click <a href=\""; foundHelper = helpers.unhide_url; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.unhide_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; } @@ -69,7 +96,7 @@ foundHelper = helpers.id; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; } - buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to unhide it\n "; + buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to unhide it\n "; return buffer;} stack1 = depth0.deleted; @@ -77,11 +104,11 @@ if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n\n"; stack1 = depth0.purged; - stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)}); + stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(6, program6, data)}); if(stack1 || stack1 === 0) { buffer += stack1; } buffer += "\n\n"; stack1 = depth0.visible; - stack1 = helpers.unless.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); + stack1 = helpers.unless.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(9, program9, data)}); if(stack1 || stack1 === 0) { buffer += stack1; } return buffer;}); })(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-warningmessagesmall.js --- a/static/scripts/templates/compiled/template-warningmessagesmall.js +++ b/static/scripts/templates/compiled/template-warningmessagesmall.js @@ -2,14 +2,13 @@ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['template-warningmessagesmall'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; - var buffer = "", stack1, foundHelper, functionType="function"; + var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression; - buffer += "<div class=warningmessagesmall><strong>"; + buffer += " \n <div class=\"warningmessagesmall\"><strong>"; foundHelper = helpers.warning; if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); } else { stack1 = depth0.warning; stack1 = typeof stack1 === functionType ? stack1() : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "</strong></div>"; + buffer += escapeExpression(stack1) + "</strong></div>"; return buffer;}); })(); \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/history-templates.html --- a/static/scripts/templates/history-templates.html +++ b/static/scripts/templates/history-templates.html @@ -1,38 +1,40 @@ <script type="text/template" class="template-history" id="template-history-warning-messages"> -{{#if deleted}} -<div class=warningmessagesmall><strong> -This dataset has been deleted. +{{#if deleted}}{{#warningmessagesmall}} + This dataset has been deleted. {{#if undelete_url}} - Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}" - target="galaxy_history">here</a> to undelete it + Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}" + target="galaxy_history">here</a> to undelete it {{#if purge_url}} - or - <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}" + or <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}" target="galaxy_history">here</a> to immediately remove it from disk {{/if}} {{/if}} -</strong></div> -{{/if}} +{{/warningmessagesmall}}{{/if}} -{{#if purged}} -<div class=warningmessagesmall><strong> -This dataset has been deleted and removed from disk. -</strong></div> -{{/if}} +{{#if purged}}{{#warningmessagesmall}} + This dataset has been deleted and removed from disk. +{{/warningmessagesmall}}{{/if}} -{{#unless visible}} -<div class=warningmessagesmall><strong> -This dataset has been hidden. +{{#unless visible}}{{#warningmessagesmall}} + This dataset has been hidden. {{#if undelete_url}} - Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}" - target="galaxy_history">here</a> to unhide it + Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}" + target="galaxy_history">here</a> to unhide it {{/if}} -</strong></div> -{{/unless}} +{{/warningmessagesmall}}{{/unless}} +</script> + +<script type="text/template" class="template-history" id="template-history-titleLink"> +<a href="javascript:void(0);"><span class="historyItemTitle">{{ hid }}: {{ name }}</span></a></script><script type="text/template" class="template-history" id="template-history-hdaSummary"> {{ misc_blurb }}<br /> -format: <span class="{{ data_type }}">{{ data_type }}</span>, ', -database: {{ dbkeyHTML }} +format: <span class="{{ data_type }}">{{ data_type }}</span>, +database: +{{#if dbkey_unknown_and_editable }} + <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a> +{{else}} + <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span> +{{/if}} </script> diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-hdaSummary.handlebars --- a/static/scripts/templates/template-history-hdaSummary.handlebars +++ b/static/scripts/templates/template-history-hdaSummary.handlebars @@ -1,3 +1,8 @@ {{ misc_blurb }}<br /> -format: <span class="{{ data_type }}">{{ data_type }}</span>, ', -database: {{ dbkeyHTML }} \ No newline at end of file +format: <span class="{{ data_type }}">{{ data_type }}</span>, +database: +{{#if dbkey_unknown_and_editable }} + <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a> +{{else}} + <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span> +{{/if}} \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-titleLink.handlebars --- /dev/null +++ b/static/scripts/templates/template-history-titleLink.handlebars @@ -0,0 +1,1 @@ +<a href="javascript:void(0);"><span class="historyItemTitle">{{ hid }}: {{ name }}</span></a> \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-warning-messages.handlebars --- a/static/scripts/templates/template-history-warning-messages.handlebars +++ b/static/scripts/templates/template-history-warning-messages.handlebars @@ -1,30 +1,23 @@ -{{#if deleted}} -<div class=warningmessagesmall><strong> -This dataset has been deleted. +{{#if deleted}}{{#warningmessagesmall}} + This dataset has been deleted. {{#if undelete_url}} - Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}" - target="galaxy_history">here</a> to undelete it + Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}" + target="galaxy_history">here</a> to undelete it {{#if purge_url}} - or - <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}" + or <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}" target="galaxy_history">here</a> to immediately remove it from disk {{/if}} {{/if}} -</strong></div> -{{/if}} +{{/warningmessagesmall}}{{/if}} -{{#if purged}} -<div class=warningmessagesmall><strong> -This dataset has been deleted and removed from disk. -</strong></div> -{{/if}} +{{#if purged}}{{#warningmessagesmall}} + This dataset has been deleted and removed from disk. +{{/warningmessagesmall}}{{/if}} -{{#unless visible}} -<div class=warningmessagesmall><strong> -This dataset has been hidden. +{{#unless visible}}{{#warningmessagesmall}} + This dataset has been hidden. {{#if undelete_url}} - Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}" - target="galaxy_history">here</a> to unhide it + Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}" + target="galaxy_history">here</a> to unhide it {{/if}} -</strong></div> -{{/unless}} \ No newline at end of file +{{/warningmessagesmall}}{{/unless}} \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-warningmessagesmall.handlebars --- a/static/scripts/templates/template-warningmessagesmall.handlebars +++ b/static/scripts/templates/template-warningmessagesmall.handlebars @@ -1,1 +1,2 @@ -<div class=warningmessagesmall><strong>{{{warning}}}</strong></div> \ No newline at end of file +{{! renders a warning in a (mostly css) highlighted, iconned warning box }} + <div class="warningmessagesmall"><strong>{{ warning }}</strong></div> \ No newline at end of file diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 templates/root/alternate_history.mako --- a/templates/root/alternate_history.mako +++ b/templates/root/alternate_history.mako @@ -116,13 +116,17 @@ add_to_data( edit_url=edit_url ) # delete button - if for_editing and not ( dataset_purged or purged ): - add_to_data( delete_url=h.url_for( controller='dataset', action='delete', dataset_id=encoded_data_id ) ) + if for_editing and not ( deleted or dataset_purged or purged ): + add_to_data( delete_url=h.url_for( controller='dataset', action='delete', dataset_id=encoded_data_id, ##TODO: loose end - ##show_deleted_on_refresh=show_deleted_on_refresh ) ) - #show_deleted_on_refresh=False ) ) + show_deleted_on_refresh=show_deleted + )) - #print app + # error report + if for_editing: + #NOTE: no state == 'error' check + add_to_data( report_error_url=h.url_for( h.url_for( controller='dataset', action='errors', id=encoded_data_id ) ) ) + if hda.ext in app.datatypes_registry.get_available_tracks(): # do these need _localized_ dbkeys? trackster_urls = {} @@ -209,7 +213,7 @@ data_dict.update( kwargs ) # trans - add_to_data( non_encoded_id=data.id ) + add_to_data( hid=data.hid ) encoded_data_id = trans.security.encode_id( data.id ) add_to_data( id=encoded_data_id ) @@ -294,9 +298,9 @@ ${h.templates( "helpers-common-templates", - "template-warningmessagesmall", "template-history-warning-messages", + "template-history-titleLink", "template-history-hdaSummary" )} 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.
participants (1)
-
Bitbucket