f1b861623af3f6c4ec36c745db34c3a72438ff9f angie Tue Jul 19 09:21:12 2016 -0700 Added new hg.conf setting surveyLabelImage -- if present, then hgGateway will display an <img> with the setting value as src to the right of the GO button. refs #17622 diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js index e8164bd..59e18c0 100644 --- src/hg/js/hgGateway.js +++ src/hg/js/hgGateway.js @@ -12,31 +12,31 @@ // (and list of hubs above the tree, if any) in a pre-existing SVG element -- see // hg/hgGateway/hgGateway.html. // rainbow: module that exports draw() function and colors. draw() adds stripes using // a spectrum of colors that are associated to species groups. The hgGateway view code // uses coordinates of stripes within the tree image to create a corresponding "rainbow" // slider bar to the left of the phylogenetic tree container. // autocompleteCat: customized JQuery autocomplete plugin that includes watermark and // can display results broken down by category (for example, genomes from various // assembly hubs and native genomes). // hgGateway: module of mostly view/controller code (model state comes directly from server). // Globals (pragma for jshint): -/* globals dbDbTree, activeGenomes, surveyLink, surveyLabel, cart */ +/* globals dbDbTree, activeGenomes, surveyLink, surveyLabel, surveyLabelImage, cart */ /* globals calculateHgTracksWidth */ // function is defined in utils.js function svgCreateEl(type, config) { // Helper function for creating a new SVG element and initializing its // properties and attributes. Type is something like 'rect', 'text', 'g', etc; // config is an object like { id: 'newThingie', x: 0, y: 10, title: 'blah blah' }. var svgns = 'http://www.w3.org/2000/svg'; var xlinkns = 'http://www.w3.org/1999/xlink'; var el = document.createElementNS(svgns, type); var title, titleEl; if (el) { _.forEach(config, function(value, setting) { if (setting === 'textContent') { // Text content (the text in a text element or title element) is a property: @@ -1610,35 +1610,41 @@ $form.submit(); } function replaceHgsidInLinks() { // Substitute '$hgsid' with real hgsid in <a> href's. $('a').each(function(ix, aEl) { var href = aEl.getAttribute('href'); if (href && href.indexOf('$hgsid') >= 0) { aEl.setAttribute('href', href.replace('$hgsid', window.hgsid)); } }); } function displaySurvey() { // If hg.conf specifies a survey link, then hgGateway.c has set corresponding global vars. - // Use those to display a labeled link (possibly with html) in the otherwise empty + // Use those to display a labeled link (possibly an <img>) in the otherwise empty // #surveyContainer. - if (surveyLink && surveyLabel) { + var label; + if (surveyLink && (surveyLabel || surveyLabelImage)) { + if (surveyLabelImage) { + label = '<img src="' + surveyLabelImage + '" alt="' + surveyLabel + '">'; + } else { + label = surveyLabel; + } $('#surveyContainer').html('<a href="' + surveyLink + '" target=_blank>' + - surveyLabel + '</a>'); + label + '</a>'); } } function init() { // Boot up the page; initialize elements and install event handlers. var searchObj = {}; // We need a bound function to pass into autocompleteCat.init below; // however, autocompleteFromTree is even slower than drawing the tree because of // all the copying. So bind now, fill in searchObj later. var processSpeciesResults = processSpeciesAutocompleteItems.bind(null, searchObj); cart.setCgi('hgGateway'); cart.debug(debugCartJson); // Get state from cart cart.send({ getUiState: {} }, handleRefreshState); cart.flush();