1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/9867a7110f6d/ changeset: 9867a7110f6d user: carlfeberhard date: 2012-09-13 20:08:09 summary: fixes to iconButton template; have IconButtonView use that template affected #: 8 files diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 lib/galaxy/web/controllers/root.py --- a/lib/galaxy/web/controllers/root.py +++ b/lib/galaxy/web/controllers/root.py @@ -122,7 +122,7 @@ history_panel_template = "root/history.mako" # history panel -> backbone - ##history_panel_template = "root/alternate_history.mako" + #history_panel_template = "root/alternate_history.mako" return trans.stream_template_mako( history_panel_template, history = history, annotation = self.get_item_annotation_str( trans.sa_session, trans.user, history ), diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/mvc/history.js --- a/static/scripts/mvc/history.js +++ b/static/scripts/mvc/history.js @@ -167,7 +167,7 @@ // view for HistoryItem model above // uncomment this out see log messages - logger : console, + //logger : console, tagName : "div", className : "historyItemContainer", @@ -763,9 +763,12 @@ }); -//============================================================================== +//------------------------------------------------------------------------------ //HistoryItemView.templates = InDomTemplateLoader.getTemplates({ HistoryItemView.templates = CompiledTemplateLoader.getTemplates({ + 'common-templates.html' : { + warningMsg : 'template-warningmessagesmall', + }, 'history-templates.html' : { messages : 'template-history-warning-messages', titleLink : 'template-history-titleLink', diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/mvc/ui.js --- a/static/scripts/mvc/ui.js +++ b/static/scripts/mvc/ui.js @@ -35,12 +35,7 @@ * */ var IconButtonView = Backbone.View.extend({ - tagName : 'a', - className : 'icon-button', - // jsHint.shut( up ) - hrefVoidFn : [ 'javascript', ':void(0)' ].join( '' ), - fadeSpeed : 0, initialize : function(){ // better rendering this way (for me anyway) @@ -49,48 +44,16 @@ }, render : function(){ - //NOTE: this is meant to be rerendered on a model change - // - since most of the rendering is attributes, it gets complicated - //TODO: template would be faster, more concise - more PITA - var disabled_class = this.model.attributes.icon_class + '_disabled'; + //NOTE: not doing this hide will lead to disappearing buttons when they're both being hovered over & rendered + this.$el.tooltip( 'hide' ); - if( !this.model.attributes.visible ){ - //TODO: fancy - but may not work as you expect - this.$el.fadeOut( this.fadeSpeed ); - } + // template in common-templates.html + var newElem = $( Handlebars.partials.iconButton( this.model.toJSON() ) ); + newElem.tooltip( this.model.get( 'tooltip_config' ) ); - if( this.model.attributes.enabled ){ - if( this.$el.hasClass( disabled_class ) ){ - this.$el.removeClass( disabled_class ); - } - this.$el.addClass( this.model.attributes.icon_class ); - } else { - this.$el.removeClass( this.model.attributes.icon_class ); - this.$el.addClass( disabled_class ); - } + this.$el.replaceWith( newElem ); + this.setElement( newElem ); - if( this.model.attributes.isMenuButton ){ - this.$el.addClass( 'menu-button' ); - } else { - this.$el.removeClass( 'menu-button' ); - } - - this.$el.data( 'tooltip', false ); - this.$el.attr( 'data-original-title', null ); - this.$el.removeClass( 'tooltip' ); - if( this.model.attributes.title ){ - this.$el.attr( 'title', this.model.attributes.title ).addClass( 'tooltip' ); - this.$el.tooltip( this.model.attributes.tooltip_config ); - } - - this.$el.attr( 'id', ( this.model.attributes.id )?( this.model.attributes.id ):( null ) ); - this.$el.attr( 'target', ( this.model.attributes.target )?( this.model.attributes.target ):( null ) ); - this.$el.attr( 'href', ( this.model.attributes.href && !this.model.attributes.on_click )? - ( this.model.attributes.href ):( this.hrefVoidFn ) ); - - if( this.model.attributes.visible ){ - this.$el.fadeIn( this.fadeSpeed ); - } return this; }, @@ -99,6 +62,7 @@ }, click : function( event ){ + console.debug( 'click event' ); // if on_click pass to that function if( this.model.attributes.on_click ){ this.model.attributes.on_click( event ); @@ -108,6 +72,10 @@ return true; } }); +//TODO: bc h.templates is gen. loaded AFTER ui, Handlebars.partials.iconButton === undefined +IconButtonView.templates = { + iconButton : Handlebars.partials.iconButton +}; var IconButtonCollection = Backbone.Collection.extend({ diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/common-templates.html --- a/static/scripts/templates/common-templates.html +++ b/static/scripts/templates/common-templates.html @@ -16,7 +16,7 @@ <script type="text/template" class="template-common" id="template-warningmessagesmall"> {{! renders a warning in a (mostly css) highlighted, iconned warning box }} - <div class="warningmessagesmall"><strong>{{ warning }}</strong></div> + <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div></script><script type="text/javascript" class="helper-common" id="helper-iconButton"> @@ -29,7 +29,7 @@ var buffer = ""; buffer += ( buttonData.enabled )?( '<a' ):( '<span' ); - if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; } + if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; } buffer += ' class="icon-button'; if( buttonData.isMenuButton ){ buffer += ' menu-button'; } @@ -44,7 +44,7 @@ if( !buttonData.visible ){ buffer += ' style="display: none;"'; } - buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); + buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); return buffer; }); </script> diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/compiled/helpers-common-templates.js --- a/static/scripts/templates/compiled/helpers-common-templates.js +++ b/static/scripts/templates/compiled/helpers-common-templates.js @@ -12,7 +12,7 @@ var buffer = ""; buffer += ( buttonData.enabled )?( '<a' ):( '<span' ); - if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; } + if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; } buffer += ' class="icon-button'; if( buttonData.isMenuButton ){ buffer += ' menu-button'; } @@ -27,7 +27,7 @@ if( !buttonData.visible ){ buffer += ' style="display: none;"'; } - buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); + buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) ); return buffer; }); /** Renders a warning in a (mostly css) highlighted, iconned warning box diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/compiled/template-warningmessagesmall.js --- a/static/scripts/templates/compiled/template-warningmessagesmall.js +++ b/static/scripts/templates/compiled/template-warningmessagesmall.js @@ -2,13 +2,14 @@ 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", escapeExpression=this.escapeExpression; + var buffer = "", stack1, foundHelper, functionType="function"; 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; } - buffer += escapeExpression(stack1) + "</strong></div>"; + if(stack1 || stack1 === 0) { buffer += stack1; } + buffer += "</strong></div>"; return buffer;}); })(); \ No newline at end of file diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/template-warningmessagesmall.handlebars --- a/static/scripts/templates/template-warningmessagesmall.handlebars +++ b/static/scripts/templates/template-warningmessagesmall.handlebars @@ -1,2 +1,2 @@ {{! renders a warning in a (mostly css) highlighted, iconned warning box }} - <div class="warningmessagesmall"><strong>{{ warning }}</strong></div> \ No newline at end of file + <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div> \ No newline at end of file diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 templates/root/alternate_history.mako --- a/templates/root/alternate_history.mako +++ b/templates/root/alternate_history.mako @@ -298,6 +298,7 @@ ${h.templates( "helpers-common-templates", + "template-warningmessagesmall", "template-history-warning-messages", "template-history-titleLink", @@ -314,34 +315,6 @@ "mvc/history" ##"mvc/tags", "mvc/annotations" )} - - <script type="text/javascript"> - GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } ); - // add needed controller urls to GalaxyPaths - galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" ) - - // Init. on document load. - var pageData = ${context_to_js()}; - - //USE_MOCK_DATA = true; - - $(function(){ - if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); } - if( window.USE_MOCK_DATA ){ - if( console && console.debug ){ console.debug( '\t using mock data' ); } - createMockHistoryData(); - return; - } - - glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas ); - glx_history_view = new HistoryView({ model: glx_history }); - glx_history_view.render(); - - hi = glx_history.items.at( 0 ); - hi_view = new HistoryItemView({ model: hi }); - $( 'body' ).append( hi_view.render() ); - }); - </script></%def><%def name="stylesheets()"> @@ -385,5 +358,41 @@ ${_('Galaxy History')} </%def> +<script type="text/javascript"> + GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } ); + // add needed controller urls to GalaxyPaths + galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" ) + + // Init. on document load. + var pageData = ${context_to_js()}; + + //USE_MOCK_DATA = true; + USE_CURR_DATA = true; + + $(function(){ + if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); } + + if( window.USE_MOCK_DATA ){ + if( console && console.debug ){ console.debug( '\t using mock data' ); } + createMockHistoryData(); + return; + + } else if ( USE_CURR_DATA ){ + if( console && console.debug ){ console.debug( '\t using current history data' ); } + glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas ); + glx_history_view = new HistoryView({ model: glx_history }); + glx_history_view.render(); + + hi = glx_history.items.at( 0 ); + hi_view = new HistoryItemView({ model: hi }); + $( 'body' ).append( hi_view.render() ); + return; + } + + // sandbox here + }); +</script> + + <body class="historyPage"></body> 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.