fb99380032dcd6e5b1d9a75548f553ee8abe11a7 kate Mon Feb 8 16:05:47 2016 -0800 Add apply button to trackUi popup (but suppress in description only page, e.g. from trtrackSearch results). refs #16788 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 0d7e3f9..6a746cd 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3458,59 +3458,65 @@ var subtrack = tdbIsSubtrack(hgTracks.trackDb[popUp.trackName]) ? popUp.trackName :""; // Saves the original vars (and vals) that may get changed by the popup cfg. popUp.saveAllVars = getAllVars( $('#hgTrackUiDialog'), subtrack ); // -- popup.ready() -- Here is the place to do things that might otherwise go // into a $('#pop').ready() routine! } // Searching for some semblance of size suitability var popMaxHeight = ($(window).height() - 40); var popMaxWidth = ($(window).width() - 40); var popWidth = 640; if (popWidth > popMaxWidth) popWidth = popMaxWidth; + // Create dialog buttons for UI popup + var uiDialogButtons = {}; + if (popUp.trackDescriptionOnly) { + uiDialogButtons.OK = function() { + $(this).dialog("close"); + }; + } else { + uiDialogButtons.Apply = function() { + popUp.uiDialogOk($('#pop'), popUp.trackName); + // thanks to JAT for this cleverness to keep button functioning + popUp.saveAllVars = getAllVars( $('#hgTrackUiDialog'), popUp.trackName); + }; + uiDialogButtons.OK = function() { + popUp.uiDialogOk($('#pop'), popUp.trackName); + $(this).dialog("close"); + }; + } + $('#hgTrackUiDialog').dialog({ ajaxOptions: { // This doesn't work cache: true }, resizable: true, // Let description scroll vertically height: (popUp.trackDescriptionOnly ? popMaxHeight : 'auto'), width: popWidth, minHeight: 200, minWidth: 400, maxHeight: popMaxHeight, maxWidth: popMaxWidth, modal: true, closeOnEscape: true, autoOpen: false, + buttons: uiDialogButtons, - buttons: { - // TODO: Enable when ready to deploy this feature - //'Apply': function () { - //popUp.uiDialogOk($('#pop'), popUp.trackName); - // thanks to JAT for this cleverness to keep button functioning - //popUp.saveAllVars = getAllVars( $('#hgTrackUiDialog'), popUp.trackName); - //}, - 'OK': function() { - if ( ! popUp.trackDescriptionOnly ) - popUp.uiDialogOk($('#pop'), popUp.trackName); - $(this).dialog("close"); - } - }, // popup.ready() doesn't seem to work in open. open: function () { if (!popUp.trackDescriptionOnly) { $('#hgTrackUiDialog').find('.filterBy,.filterComp').each( function(i) { if ($(this).hasClass('filterComp')) ddcl.setup(this); else ddcl.setup(this, 'noneIsAll'); } ); } }, close: function() {