1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/91c9b4fb1c06/ Changeset: 91c9b4fb1c06 User: guerler Date: 2013-11-05 19:52:35 Summary: UI: Rename galaxy.master.js to galaxy.masthead.js Affected #: 11 files diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/galaxy.frame.js --- a/static/scripts/galaxy.frame.js +++ b/static/scripts/galaxy.frame.js @@ -3,7 +3,7 @@ */ // dependencies -define(["galaxy.master", "libs/backbone/backbone-relational"], function(mod_master) { +define(["galaxy.masthead", "libs/backbone/backbone-relational"], function(mod_masthead) { // frame manager var GalaxyFrame = Backbone.View.extend( @@ -79,11 +79,11 @@ // initialize initialize : function(options) { - // add to master menu + // add to masthead menu var self = this; // add activate icon - this.button_active = new mod_master.GalaxyMasterIcon ( + this.button_active = new mod_masthead.GalaxyMastheadIcon ( { icon : 'fa-th', tooltip : 'Enable/Disable Scratchbook', @@ -94,11 +94,11 @@ } }); - // add to master - Galaxy.master.append(this.button_active); + // add to masthead + Galaxy.masthead.append(this.button_active); // add load icon - this.button_load = new mod_master.GalaxyMasterIcon ( + this.button_load = new mod_masthead.GalaxyMastheadIcon ( { icon : 'fa-eye', tooltip : 'Show/Hide Scratchbook', @@ -106,8 +106,8 @@ with_number : true }); - // add to master - Galaxy.master.append(this.button_load); + // add to masthead + Galaxy.masthead.append(this.button_load); // read in defaults if (options) diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/galaxy.master.js --- a/static/scripts/galaxy.master.js +++ /dev/null @@ -1,498 +0,0 @@ -/* - galaxy master -*/ - -// dependencies -define(["utils/galaxy.utils", "libs/backbone/backbone-relational"], function(mod_utils) { - -// master -var GalaxyMaster = Backbone.View.extend( -{ - // base element - el_master: '#everything', - - // options - options : null, - - // item list - list : {}, - - // keeps track of the last element - itemLast: null, - - // counter - itemCounter: 0, - - // background - $background: null, - - // flag indicating visibility of background - backgroundVisible: false, - - // initialize - initialize : function(options) - { - // update options - this.options = options; - - // HACK: due to body events defined in galaxy.panels.js - $("body").off(); - - // define this element - this.setElement($(this._template(options))); - - // append to master - $(this.el_master).append($(this.el)); - - // assign background - this.$background = $(this.el).find('#master-background'); - - // loop through item specific unload functions - // and collect all there warning messages, regarding - // the user's attempt to unload the page - var self = this; - window.onbeforeunload = function() - { - var text = ""; - for (key in self.list) - if (self.list[key].options.on_unload) - { - var q = self.list[key].options.on_unload(); - if (q) text += q + " "; - } - if (text != "") - return text; - }; - }, - - // configure events - events: - { - 'click' : '_eventRefresh', - 'mousedown' : function(e) { e.preventDefault() } - }, - - // adds a new item to the master - append : function(item) - { - return this._add(item, true); - }, - - // adds a new item to the master - prepend : function(item) - { - return this._add(item, false); - }, - - // adds a new item to the master - _add : function(item, append) - { - var $loc = $(this.el).find('#' + item.masterLocation); - if ($loc) - { - // create frame for new item - var itemId = 'master-item-' + this.itemCounter++; - var $itemNew = $(item.el); - - // configure id and class in order to mark new items - $itemNew.attr('id', itemId); - $itemNew.addClass('master-item'); - - // append to master - if (append) { - $loc.append($itemNew); - } else { - $loc.prepend($itemNew); - } - - // add to list - this.list[itemId] = item; - - // return item id - return itemId; - } - - // location not found - return null; - }, - - // handle click event - _eventRefresh: function(e) - { - // identify current item - var itemCurrent = $(e.target).closest('.master-item'); - - // get identifier - if (itemCurrent.length) - itemCurrent = itemCurrent.attr('id'); - - // check last item - if (this.itemLast && this.itemLast != itemCurrent) - { - var it = this.list[this.itemLast]; - if (it) { - if (it.masterReset) { - it.masterReset(); - } - } - } - - // check if current item is in active state - var useBackground = false; - if (itemCurrent) - { - var it = this.list[itemCurrent]; - if (it) { - if (it.masterReset) { - if (this.itemLast == itemCurrent) { - useBackground = this.backgroundVisible ? false : true; - } else { - useBackground = true; - } - } - } - } - - // decide wether to show/hide background - if (useBackground) { - this.$background.show(); - } else { - this.$background.hide(); - } - - // backup - this.backgroundVisible = useBackground; - this.itemLast = itemCurrent; - }, - - /* - HTML TEMPLATES - */ - - // template item - _templateItem: function(id) - { - return '<div id="' + id + '" class="master-item"></div>'; - }, - - // fill template - _template: function(options) - { - return '<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse">' + - '<div style="position: relative; right: -50%; float: left;">' + - '<div id="navbar" style="display: block; position: relative; right: 50%;"></div>' + - '</div>' + - '<div class="navbar-brand">' + - '<a href="' + options.logo_url + '">' + - '<img border="0" src="' + galaxy_config.root + 'static/images/galaxyIcon_noText.png">' + - '<span id="brand"> Galaxy ' + options.brand + '</span>' + - '</a>' + - '</div>' + - '<div class="quota-meter-container"></div>' + - '<div id="iconbar" class="iconbar"></div>' + - '</div>' + - '<div id="master-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div>' + - '</div>'; - } -}); - -// icon -var GalaxyMasterIcon = Backbone.View.extend( -{ - // icon options - options: - { - id : "galaxy-icon", - icon : "fa-cog", - tooltip : "galaxy-icon", - with_number : false, - on_click : function() { alert ('clicked') }, - on_unload : null, - visible : true - }, - - // location identifier for master class - masterLocation: 'iconbar', - - // initialize - initialize: function (options) - { - // read in defaults - if (options) - this.options = _.defaults(options, this.options); - - // add template for icon - this.setElement($(this._template(this.options))); - - // configure icon - var self = this; - $(this.el).find('.icon').tooltip({title: this.options.tooltip}) - .on('mouseup', self.options.on_click); - - // visiblity - if (!this.options.visible) - this.hide(); - }, - - // show - show: function() - { - $(this.el).css({visibility : 'visible'}); - }, - - // show - hide: function() - { - $(this.el).css({visibility : 'hidden'}); - }, - - // switch icon - icon: function (new_icon) - { - // update icon class - $(this.el).find('.icon').removeClass(this.options.icon) - .addClass(new_icon); - - // update icon - this.options.icon = new_icon; - }, - - // toggle - toggle: function() - { - $(this.el).addClass('toggle'); - }, - - // untoggle - untoggle: function() - { - $(this.el).removeClass('toggle'); - }, - - // set/get number - number: function(new_number) - { - $(this.el).find('.number').text(new_number); - }, - - // fill template icon - _template: function (options) - { - var tmpl = '<div id=' + options.id + ' class="symbol">' + - '<div class="icon fa fa-2x ' + options.icon + '"></div>'; - if (options.with_number) - tmpl+= '<div class="number"></div>'; - tmpl += '</div>'; - - // return template - return tmpl; - } -}); - -// tab -var GalaxyMasterTab = Backbone.View.extend( -{ - // main options - options: - { - id : '', - title : 'Title', - target : '_parent', - content : '', - type : 'url', - scratchbook : false, - on_unload : null, - visible : true - }, - - // location - masterLocation: 'navbar', - - // optional sub menu - $menu: null, - - // flag if menu is visible - menuVisible: false, - - // events - events: - { - 'click .head' : '_eventClickHead' - }, - - // initialize - initialize: function (options) - { - // read in defaults - if (options) - this.options = _.defaults(options, this.options); - - // update url - if (this.options.content && this.options.content.indexOf('//') === -1) - this.options.content = galaxy_config.root + this.options.content; - - // add template for tab - this.setElement($(this._template(this.options))); - - // visiblity - if (!this.options.visible) - this.hide(); - }, - - // show - show: function() - { - $(this.el).css({visibility : 'visible'}); - }, - - // show - hide: function() - { - $(this.el).css({visibility : 'hidden'}); - }, - - // add menu item - addMenu: function (options) - { - // menu option defaults - var menuOptions = { - title : 'Title', - content : '', - type : 'url', - target : '_parent', - scratchbook : false, - divider : false - } - - // read in defaults - if (options) - menuOptions = _.defaults(options, menuOptions); - - // update url - if (menuOptions.content && menuOptions.content.indexOf('//') === -1) - menuOptions.content = galaxy_config.root + menuOptions.content; - - // check if submenu element is available - if (!this.$menu) - { - // insert submenu element into root - $(this.el).find('.root').append(this._templateMenu()); - - // show caret - $(this.el).find('.symbol').addClass('caret'); - - // update element link - this.$menu = $(this.el).find('.menu'); - } - - // create - var $item = $(this._templateMenuItem(menuOptions)); - - // append menu - this.$menu.append($item); - - // add events - var self = this; - $item.on('click', function(e) - { - // prevent default - e.preventDefault(); - - // check for menu options - self._hideMenu(); - - // no modifications if new tab is requested - if (self.options.target === '_blank') - return true; - - // load into frame - Galaxy.frame.add(options); - }); - - // append divider - if (menuOptions.divider) - this.$menu.append($(this._templateDivider())); - }, - - // add reset function called by master - masterReset: function() - { - this._hideMenu(); - }, - - // hide menu - _hideMenu: function() - { - if (this.$menu && this.menuVisible) - { - this.$menu.hide(); - this.menuVisible = false; - } - }, - - // show menu on header click - _eventClickHead: function(e) - { - // prevent default - e.preventDefault(); - - // check for menu options - if (this.$menu) - { - // show/hide menu - if (!this.menuVisible) - { - this.$menu.show(); - this.menuVisible = true; - } else { - this.$menu.hide(); - this.menuVisible = false; - } - } else { - // open new frame - Galaxy.frame.add(this.options); - } - }, - - // fill template header - _templateMenuItem: function (options) - { - return '<li><a href="' + options.content + '" target="' + options.target + '">' + options.title + '</a></li>'; - }, - - // fill template header - _templateMenu: function () - { - return '<ul class="menu dropdown-menu"></ul>'; - }, - - _templateDivider: function() - { - return '<li class="divider"></li>'; - }, - - // fill template - _template: function (options) - { - // start template - var tmpl = '<ul class="nav navbar-nav" border="0" cellspacing="0">' + - '<li class="root dropdown" style="">' + - '<a class="head dropdown-toggle" data-toggle="dropdown" target="' + options.target + '" href="' + options.content + '">' + - options.title + '<b class="symbol"></b>' + - '</a>' + - '</li>' + - '</ul>'; - - // return template - return tmpl; - } -}); - -// return -return { - GalaxyMaster: GalaxyMaster, - GalaxyMasterTab: GalaxyMasterTab, - GalaxyMasterIcon: GalaxyMasterIcon -}; - -}); diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/galaxy.masthead.js --- /dev/null +++ b/static/scripts/galaxy.masthead.js @@ -0,0 +1,498 @@ +/* + galaxy masthead +*/ + +// dependencies +define(["utils/galaxy.utils", "libs/backbone/backbone-relational"], function(mod_utils) { + +// masthead +var GalaxyMasthead = Backbone.View.extend( +{ + // base element + el_masthead: '#everything', + + // options + options : null, + + // item list + list : {}, + + // keeps track of the last element + itemLast: null, + + // counter + itemCounter: 0, + + // background + $background: null, + + // flag indicating visibility of background + backgroundVisible: false, + + // initialize + initialize : function(options) + { + // update options + this.options = options; + + // HACK: due to body events defined in galaxy.panels.js + $("body").off(); + + // define this element + this.setElement($(this._template(options))); + + // append to masthead + $(this.el_masthead).append($(this.el)); + + // assign background + this.$background = $(this.el).find('#masthead-background'); + + // loop through item specific unload functions + // and collect all there warning messages, regarding + // the user's attempt to unload the page + var self = this; + window.onbeforeunload = function() + { + var text = ""; + for (key in self.list) + if (self.list[key].options.on_unload) + { + var q = self.list[key].options.on_unload(); + if (q) text += q + " "; + } + if (text != "") + return text; + }; + }, + + // configure events + events: + { + 'click' : '_eventRefresh', + 'mousedown' : function(e) { e.preventDefault() } + }, + + // adds a new item to the masthead + append : function(item) + { + return this._add(item, true); + }, + + // adds a new item to the masthead + prepend : function(item) + { + return this._add(item, false); + }, + + // adds a new item to the masthead + _add : function(item, append) + { + var $loc = $(this.el).find('#' + item.mastheadLocation); + if ($loc) + { + // create frame for new item + var itemId = 'masthead-item-' + this.itemCounter++; + var $itemNew = $(item.el); + + // configure id and class in order to mark new items + $itemNew.attr('id', itemId); + $itemNew.addClass('masthead-item'); + + // append to masthead + if (append) { + $loc.append($itemNew); + } else { + $loc.prepend($itemNew); + } + + // add to list + this.list[itemId] = item; + + // return item id + return itemId; + } + + // location not found + return null; + }, + + // handle click event + _eventRefresh: function(e) + { + // identify current item + var itemCurrent = $(e.target).closest('.masthead-item'); + + // get identifier + if (itemCurrent.length) + itemCurrent = itemCurrent.attr('id'); + + // check last item + if (this.itemLast && this.itemLast != itemCurrent) + { + var it = this.list[this.itemLast]; + if (it) { + if (it.mastheadReset) { + it.mastheadReset(); + } + } + } + + // check if current item is in active state + var useBackground = false; + if (itemCurrent) + { + var it = this.list[itemCurrent]; + if (it) { + if (it.mastheadReset) { + if (this.itemLast == itemCurrent) { + useBackground = this.backgroundVisible ? false : true; + } else { + useBackground = true; + } + } + } + } + + // decide wether to show/hide background + if (useBackground) { + this.$background.show(); + } else { + this.$background.hide(); + } + + // backup + this.backgroundVisible = useBackground; + this.itemLast = itemCurrent; + }, + + /* + HTML TEMPLATES + */ + + // template item + _templateItem: function(id) + { + return '<div id="' + id + '" class="masthead-item"></div>'; + }, + + // fill template + _template: function(options) + { + return '<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse">' + + '<div style="position: relative; right: -50%; float: left;">' + + '<div id="navbar" style="display: block; position: relative; right: 50%;"></div>' + + '</div>' + + '<div class="navbar-brand">' + + '<a href="' + options.logo_url + '">' + + '<img border="0" src="' + galaxy_config.root + 'static/images/galaxyIcon_noText.png">' + + '<span id="brand"> Galaxy ' + options.brand + '</span>' + + '</a>' + + '</div>' + + '<div class="quota-meter-container"></div>' + + '<div id="iconbar" class="iconbar"></div>' + + '</div>' + + '<div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div>' + + '</div>'; + } +}); + +// icon +var GalaxyMastheadIcon = Backbone.View.extend( +{ + // icon options + options: + { + id : "galaxy-icon", + icon : "fa-cog", + tooltip : "galaxy-icon", + with_number : false, + on_click : function() { alert ('clicked') }, + on_unload : null, + visible : true + }, + + // location identifier for masthead class + mastheadLocation: 'iconbar', + + // initialize + initialize: function (options) + { + // read in defaults + if (options) + this.options = _.defaults(options, this.options); + + // add template for icon + this.setElement($(this._template(this.options))); + + // configure icon + var self = this; + $(this.el).find('.icon').tooltip({title: this.options.tooltip}) + .on('mouseup', self.options.on_click); + + // visiblity + if (!this.options.visible) + this.hide(); + }, + + // show + show: function() + { + $(this.el).css({visibility : 'visible'}); + }, + + // show + hide: function() + { + $(this.el).css({visibility : 'hidden'}); + }, + + // switch icon + icon: function (new_icon) + { + // update icon class + $(this.el).find('.icon').removeClass(this.options.icon) + .addClass(new_icon); + + // update icon + this.options.icon = new_icon; + }, + + // toggle + toggle: function() + { + $(this.el).addClass('toggle'); + }, + + // untoggle + untoggle: function() + { + $(this.el).removeClass('toggle'); + }, + + // set/get number + number: function(new_number) + { + $(this.el).find('.number').text(new_number); + }, + + // fill template icon + _template: function (options) + { + var tmpl = '<div id=' + options.id + ' class="symbol">' + + '<div class="icon fa fa-2x ' + options.icon + '"></div>'; + if (options.with_number) + tmpl+= '<div class="number"></div>'; + tmpl += '</div>'; + + // return template + return tmpl; + } +}); + +// tab +var GalaxyMastheadTab = Backbone.View.extend( +{ + // main options + options: + { + id : '', + title : 'Title', + target : '_parent', + content : '', + type : 'url', + scratchbook : false, + on_unload : null, + visible : true + }, + + // location + mastheadLocation: 'navbar', + + // optional sub menu + $menu: null, + + // flag if menu is visible + menuVisible: false, + + // events + events: + { + 'click .head' : '_eventClickHead' + }, + + // initialize + initialize: function (options) + { + // read in defaults + if (options) + this.options = _.defaults(options, this.options); + + // update url + if (this.options.content && this.options.content.indexOf('//') === -1) + this.options.content = galaxy_config.root + this.options.content; + + // add template for tab + this.setElement($(this._template(this.options))); + + // visiblity + if (!this.options.visible) + this.hide(); + }, + + // show + show: function() + { + $(this.el).css({visibility : 'visible'}); + }, + + // show + hide: function() + { + $(this.el).css({visibility : 'hidden'}); + }, + + // add menu item + addMenu: function (options) + { + // menu option defaults + var menuOptions = { + title : 'Title', + content : '', + type : 'url', + target : '_parent', + scratchbook : false, + divider : false + } + + // read in defaults + if (options) + menuOptions = _.defaults(options, menuOptions); + + // update url + if (menuOptions.content && menuOptions.content.indexOf('//') === -1) + menuOptions.content = galaxy_config.root + menuOptions.content; + + // check if submenu element is available + if (!this.$menu) + { + // insert submenu element into root + $(this.el).find('.root').append(this._templateMenu()); + + // show caret + $(this.el).find('.symbol').addClass('caret'); + + // update element link + this.$menu = $(this.el).find('.menu'); + } + + // create + var $item = $(this._templateMenuItem(menuOptions)); + + // append menu + this.$menu.append($item); + + // add events + var self = this; + $item.on('click', function(e) + { + // prevent default + e.preventDefault(); + + // check for menu options + self._hideMenu(); + + // no modifications if new tab is requested + if (self.options.target === '_blank') + return true; + + // load into frame + Galaxy.frame.add(options); + }); + + // append divider + if (menuOptions.divider) + this.$menu.append($(this._templateDivider())); + }, + + // add reset function called by masthead + mastheadReset: function() + { + this._hideMenu(); + }, + + // hide menu + _hideMenu: function() + { + if (this.$menu && this.menuVisible) + { + this.$menu.hide(); + this.menuVisible = false; + } + }, + + // show menu on header click + _eventClickHead: function(e) + { + // prevent default + e.preventDefault(); + + // check for menu options + if (this.$menu) + { + // show/hide menu + if (!this.menuVisible) + { + this.$menu.show(); + this.menuVisible = true; + } else { + this.$menu.hide(); + this.menuVisible = false; + } + } else { + // open new frame + Galaxy.frame.add(this.options); + } + }, + + // fill template header + _templateMenuItem: function (options) + { + return '<li><a href="' + options.content + '" target="' + options.target + '">' + options.title + '</a></li>'; + }, + + // fill template header + _templateMenu: function () + { + return '<ul class="menu dropdown-menu"></ul>'; + }, + + _templateDivider: function() + { + return '<li class="divider"></li>'; + }, + + // fill template + _template: function (options) + { + // start template + var tmpl = '<ul class="nav navbar-nav" border="0" cellspacing="0">' + + '<li class="root dropdown" style="">' + + '<a class="head dropdown-toggle" data-toggle="dropdown" target="' + options.target + '" href="' + options.content + '">' + + options.title + '<b class="symbol"></b>' + + '</a>' + + '</li>' + + '</ul>'; + + // return template + return tmpl; + } +}); + +// return +return { + GalaxyMasthead: GalaxyMasthead, + GalaxyMastheadTab: GalaxyMastheadTab, + GalaxyMastheadIcon: GalaxyMastheadIcon +}; + +}); diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/galaxy.menu.js --- a/static/scripts/galaxy.menu.js +++ b/static/scripts/galaxy.menu.js @@ -3,7 +3,7 @@ */ // dependencies -define(["galaxy.master", "libs/backbone/backbone-relational"], function(mod_master) { +define(["galaxy.masthead", "libs/backbone/backbone-relational"], function(mod_masthead) { // frame manager var GalaxyMenu = Backbone.Model.extend( @@ -11,14 +11,14 @@ // options options: null, - // link master class - master: null, + // link masthead class + masthead: null, // initialize initialize: function(options) { this.options = options.config; - this.master = options.master; + this.masthead = options.masthead; this.create(); }, @@ -28,26 +28,26 @@ // // Analyze data tab. // - var tab_analysis = new mod_master.GalaxyMasterTab({ + var tab_analysis = new mod_masthead.GalaxyMastheadTab({ title : "Analyze Data", content : "root/index" }); - this.master.append(tab_analysis); + this.masthead.append(tab_analysis); // // Workflow tab. // - var tab_workflow = new mod_master.GalaxyMasterTab({ + var tab_workflow = new mod_masthead.GalaxyMastheadTab({ title : "Workflow", content : "workflow" }); - this.master.append(tab_workflow); + this.masthead.append(tab_workflow); // // 'Shared Items' or Libraries tab. // - var tab_shared = new mod_master.GalaxyMasterTab({ + var tab_shared = new mod_masthead.GalaxyMastheadTab({ title : "Shared Data", content : "library/index" }); @@ -79,14 +79,14 @@ content : "page/list_published" }); - this.master.append(tab_shared); + this.masthead.append(tab_shared); // // Lab menu. // if (this.options.user.requests) { - var tab_lab = new mod_master.GalaxyMasterTab({ + var tab_lab = new mod_masthead.GalaxyMastheadTab({ title : "Lab" }); tab_lab.addMenu({ @@ -101,13 +101,13 @@ title : "Help", content : this.options.lims_doc_url }); - this.master.append(tab_lab); + this.masthead.append(tab_lab); } // // Visualization tab. // - var tab_visualization = new mod_master.GalaxyMasterTab({ + var tab_visualization = new mod_masthead.GalaxyMastheadTab({ title : "Visualization", content : "visualization/list" @@ -122,14 +122,14 @@ content : "visualization/list", target : "_frame" }); - this.master.append(tab_visualization); + this.masthead.append(tab_visualization); // // Cloud menu. // if (this.options.enable_cloud_launch) { - var tab_cloud = new mod_master.GalaxyMasterTab({ + var tab_cloud = new mod_masthead.GalaxyMastheadTab({ title : "Cloud", content : "cloudlaunch/index" }); @@ -137,7 +137,7 @@ title : "New Cloud Cluster", content : "cloudlaunch/index" }); - this.master.append(tab_cloud); + this.masthead.append(tab_cloud); } // @@ -145,18 +145,18 @@ // if (this.options.is_admin_user) { - var tab_admin = new mod_master.GalaxyMasterTab({ + var tab_admin = new mod_masthead.GalaxyMastheadTab({ title : "Admin", content : "admin/index", extra_class : "admin-only" }); - this.master.append(tab_admin); + this.masthead.append(tab_admin); } // // Help tab. // - var tab_help = new mod_master.GalaxyMasterTab({ + var tab_help = new mod_masthead.GalaxyMastheadTab({ title : "Help" }); if (this.options.biostar_url) @@ -210,14 +210,14 @@ target : "_blank" }); } - this.master.append(tab_help); + this.masthead.append(tab_help); // // User tab. // if (!this.options.user.valid) { - var tab_user = new mod_master.GalaxyMasterTab({ + var tab_user = new mod_masthead.GalaxyMastheadTab({ title : "User", extra_class : "loggedout-only" }); @@ -242,10 +242,10 @@ }); } - // add to master - this.master.append(tab_user); + // add to masthead + this.masthead.append(tab_user); } else { - var tab_user = new mod_master.GalaxyMasterTab({ + var tab_user = new mod_masthead.GalaxyMastheadTab({ title : "User", extra_class : "loggedin-only" }); @@ -316,8 +316,8 @@ }); } - // add to master - this.master.append(tab_user); + // add to masthead + this.masthead.append(tab_user); } } }); diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/galaxy.upload.js --- a/static/scripts/galaxy.upload.js +++ b/static/scripts/galaxy.upload.js @@ -3,7 +3,7 @@ */ // dependencies -define(["galaxy.modal", "galaxy.master", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master, mod_utils) { +define(["galaxy.modal", "galaxy.masthead", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_masthead, mod_utils) { // galaxy upload var GalaxyUpload = Backbone.View.extend( @@ -64,7 +64,7 @@ // add activate icon var self = this; - this.button_show = new mod_master.GalaxyMasterIcon ( + this.button_show = new mod_masthead.GalaxyMastheadIcon ( { icon : 'fa-arrow-circle-o-up', tooltip : 'Upload Files', @@ -76,8 +76,8 @@ with_number : true }); - // add to master - Galaxy.master.prepend(this.button_show); + // add to masthead + Galaxy.masthead.prepend(this.button_show); // load extension var self = this; diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/packed/galaxy.frame.js --- a/static/scripts/packed/galaxy.frame.js +++ b/static/scripts/packed/galaxy.frame.js @@ -1,1 +1,1 @@ -define(["galaxy.master","libs/backbone/backbone-relational"],function(b){var a=Backbone.View.extend({el_main:"body",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:9},cols:0,top:0,top_max:0,frame_z:0,frame_counter:0,frame_counter_id:0,frame_list:[],frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(d){var c=this;this.button_active=new b.GalaxyMasterIcon({icon:"fa-th",tooltip:"Enable/Disable Scratchbook",on_click:function(f){c._event_panel_active(f)},on_unload:function(){if(c.frame_counter>0){return"You opened "+c.frame_counter+" frame(s) which will be lost."}}});Galaxy.master.append(this.button_active);this.button_load=new b.GalaxyMasterIcon({icon:"fa-eye",tooltip:"Show/Hide Scratchbook",on_click:function(f){c._event_panel_load(f)},with_number:true});Galaxy.master.append(this.button_load);if(d){this.options=_.defaults(d,this.options)}this.top=this.top_max=this.options.top_min;this.setElement(this._template());$(this.el).append(this._template_background());$(this.el).append(this._template_menu());$(this.el_main).append($(this.el));var e="#frame-shadow";$(this.el).append(this._template_shadow(e.substring(1)));this.frame_shadow={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this._frame_resize(this.frame_shadow,{width:0,height:0});this.frame_list[e]=this.frame_shadow;this._panel_refresh();var c=this;$(window).resize(function(){if(c.visible){c._panel_refresh()}})},add:function(d){var g={title:"",content:null,target:"",type:null,scratchbook:false};if(d){d=_.defaults(d,g)}else{d=g}if(!d.content){return}if(d.target=="_blank"){window.open(d.content);return}if(d.target=="_top"||d.target=="_parent"||d.target=="_self"){window.location=d.content;return}if(!this.active){var f=$(window.parent.document).find("#galaxy_main");if(d.target=="galaxy_main"||d.target=="center"){if(f.length==0){var c=d.content;if(c.indexOf("?")==-1){c+="?"}else{c+="&"}c+="use_panels=True";window.location=c}else{f.attr("src",d.content)}}else{window.location=d.content}return}if(this.frame_counter>=this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var e="#frame-"+(this.frame_counter_id++);if($(e).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this._template_frame(e.substring(1),d.title,d.type,d.content));var h={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};d.width=this._to_pixel_coord("width",this.options.frame.cols);d.height=this._to_pixel_coord("height",this.options.frame.rows);this.frame_z=parseInt($(h.id).css("z-index"));this.frame_list[e]=h;this.frame_counter++;this._frame_resize(h,{width:d.width,height:d.height});this._frame_insert(h,{top:0,left:0},true);if(!this.visible){this._panel_show_hide()}},event:{type:null,target:null,xy:null},events:{mousemove:"_event_frame_mouse_move",mouseup:"_event_frame_mouse_up",mouseleave:"_event_frame_mouse_up",mousewheel:"_event_panel_scroll",DOMMouseScroll:"_event_panel_scroll","mousedown .frame":"_event_frame_mouse_down","mousedown .frame-background":"_event_panel_load","mousedown .frame-scroll-up":"_event_panel_scroll_up","mousedown .frame-scroll-down":"_event_panel_scroll_down","mousedown .f-close":"_event_frame_close","mousedown .f-pin":"_event_frame_lock"},_event_frame_mouse_down:function(c){if(this.event.type!==null){return}if($(c.target).hasClass("f-header")||$(c.target).hasClass("f-title")){this.event.type="drag"}if($(c.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}c.preventDefault();this.event.target=this._frame_identify(c.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:c.originalEvent.pageX,y:c.originalEvent.pageY};this._frame_drag_start(this.event.target)},_event_frame_mouse_move:function(i){if(this.event.type!="drag"&&this.event.type!="resize"){return}var g={x:i.originalEvent.pageX,y:i.originalEvent.pageY};var d={x:g.x-this.event.xy.x,y:g.y-this.event.xy.y};this.event.xy=g;var h=this._frame_screen(this.event.target);if(this.event.type=="resize"){h.width+=d.x;h.height+=d.y;var f=this.options.cell-this.options.margin-1;h.width=Math.max(h.width,f);h.height=Math.max(h.height,f);this._frame_resize(this.event.target,h);h.width=this._to_grid_coord("width",h.width)+1;h.height=this._to_grid_coord("height",h.height)+1;h.width=this._to_pixel_coord("width",h.width);h.height=this._to_pixel_coord("height",h.height);this._frame_resize(this.frame_shadow,h);this._frame_insert(this.frame_shadow,{top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)})}if(this.event.type=="drag"){h.left+=d.x;h.top+=d.y;this._frame_offset(this.event.target,h);var c={top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)};if(c.left!==0){c.left++}this._frame_insert(this.frame_shadow,c)}},_event_frame_mouse_up:function(c){if(this.event.type!="drag"&&this.event.type!="resize"){return}this._frame_drag_stop(this.event.target);this.event.type=null},_event_frame_close:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this._frame_identify(d.target);var c=this;$(f.id).fadeOut("fast",function(){$(f.id).remove();delete c.frame_list[f.id];c.frame_counter--;c._panel_refresh(true);c._panel_animation_complete();if(c.visible&&c.frame_counter==0){c._panel_show_hide()}})},_event_frame_lock:function(c){if(this.event.type!==null){return}c.preventDefault();var d=this._frame_identify(c.target);if(d.grid_lock){d.grid_lock=false;$(d.id).find(".f-pin").removeClass("toggle");$(d.id).find(".f-header").removeClass("f-not-allowed");$(d.id).find(".f-title").removeClass("f-not-allowed");$(d.id).find(".f-resize").show();$(d.id).find(".f-close").show()}else{d.grid_lock=true;$(d.id).find(".f-pin").addClass("toggle");$(d.id).find(".f-header").addClass("f-not-allowed");$(d.id).find(".f-title").addClass("f-not-allowed");$(d.id).find(".f-resize").hide();$(d.id).find(".f-close").hide()}},_event_panel_load:function(c){if(this.event.type!==null){return}this._panel_show_hide()},_event_panel_active:function(c){if(this.event.type!==null){return}this._panel_active_disable()},_event_panel_scroll:function(c){if(this.event.type!==null||!this.visible){return}c.preventDefault();var d=c.originalEvent.detail?c.originalEvent.detail:c.originalEvent.wheelDelta/-3;this._panel_scroll(d)},_event_panel_scroll_up:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(-this.options.scroll)},_event_panel_scroll_down:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(this.options.scroll)},_frame_identify:function(c){return this.frame_list["#"+$(c).closest(".frame").attr("id")]},_frame_drag_start:function(d){this._frame_focus(d,true);var c=this._frame_screen(d);this._frame_resize(this.frame_shadow,c);this._frame_grid(this.frame_shadow,d.grid_location);d.grid_location=null;$(this.frame_shadow.id).show();$(".f-cover").show()},_frame_drag_stop:function(d){this._frame_focus(d,false);var c=this._frame_screen(this.frame_shadow);this._frame_resize(d,c);this._frame_grid(d,this.frame_shadow.grid_location,true);this.frame_shadow.grid_location=null;$(this.frame_shadow.id).hide();$(".f-cover").hide();this._panel_animation_complete()},_to_grid_coord:function(e,d){var c=(e=="width"||e=="height")?1:-1;if(e=="top"){d-=this.top}return parseInt((d+c*this.options.margin)/this.options.cell,10)},_to_pixel_coord:function(e,f){var c=(e=="width"||e=="height")?1:-1;var d=(f*this.options.cell)-c*this.options.margin;if(e=="top"){d+=this.top}return d},_to_grid:function(c){return{top:this._to_grid_coord("top",c.top),left:this._to_grid_coord("left",c.left),width:this._to_grid_coord("width",c.width),height:this._to_grid_coord("height",c.height)}},_to_pixel:function(c){return{top:this._to_pixel_coord("top",c.top),left:this._to_pixel_coord("left",c.left),width:this._to_pixel_coord("width",c.width),height:this._to_pixel_coord("height",c.height)}},_is_collision:function(e){function c(h,g){return !(h.left>g.left+g.width-1||h.left+h.width-1<g.left||h.top>g.top+g.height-1||h.top+h.height-1<g.top)}for(var d in this.frame_list){var f=this.frame_list[d];if(f.grid_location===null){continue}if(c(e,f.grid_location)){return true}}return false},_location_rank:function(c){return(c.top*this.cols)+c.left},_menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".frame-scroll-up").hide()}else{$(".frame-scroll-up").show()}if(this.top==this.top_max){$(".frame-scroll-down").hide()}else{$(".frame-scroll-down").show()}},_panel_animation_complete:function(){var c=this;$(".frame").promise().done(function(){c._panel_scroll(0,true)})},_panel_refresh:function(c){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this._frame_insert(null,null,c)},_panel_scroll:function(h,c){var e=this.top-this.options.scroll*h;e=Math.max(e,this.top_max);e=Math.min(e,this.options.top_min);if(this.top!=e){for(var d in this.frame_list){var g=this.frame_list[d];if(g.grid_location!==null){var f={top:g.screen_location.top-(this.top-e),left:g.screen_location.left};this._frame_offset(g,f,c)}}this.top=e}this._menu_refresh()},_panel_show_hide:function(){if(this.visible){this.visible=false;$(".frame").fadeOut("fast");this.button_load.icon("fa-eye-slash");this.button_load.untoggle();$(".frame-background").hide();$(".frame-menu").hide()}else{this.visible=true;$(".frame").fadeIn("fast");this.button_load.icon("fa-eye");this.button_load.toggle();$(this.frame_shadow.id).hide();$(".frame-background").show();this._panel_refresh()}},_panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this._panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},_frame_insert:function(j,c,e){var d=[];if(j){j.grid_location=null;d.push([j,this._location_rank(c)])}var g=null;for(g in this.frame_list){var h=this.frame_list[g];if(h.grid_location!==null&&!h.grid_lock){h.grid_location=null;d.push([h,h.grid_rank])}}d.sort(function(k,f){var m=k[1];var l=f[1];return m<l?-1:(m>l?1:0)});for(g=0;g<d.length;g++){this._frame_place(d[g][0],e)}this.top_max=0;for(var g in this.frame_list){var j=this.frame_list[g];if(j.grid_location!==null){this.top_max=Math.max(this.top_max,j.grid_location.top+j.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this._menu_refresh()},_frame_place:function(k,d){k.grid_location=null;var h=this._to_grid(this._frame_screen(k));var c=false;for(var f=0;f<this.options.rows;f++){for(var e=0;e<Math.max(1,this.cols-h.width);e++){h.top=f;h.left=e;if(!this._is_collision(h)){c=true;break}}if(c){break}}if(c){this._frame_grid(k,h,d)}else{console.log("Grid dimensions exceeded.")}},_frame_focus:function(e,c){var d=this.frame_z+(c?1:0);$(e.id).css("z-index",d)},_frame_offset:function(f,e,d){f.screen_location.left=e.left;f.screen_location.top=e.top;if(d){this._frame_focus(f,true);var c=this;$(f.id).animate({top:e.top,left:e.left},"fast",function(){c._frame_focus(f,false)})}else{$(f.id).css({top:e.top,left:e.left})}},_frame_resize:function(d,c){$(d.id).css({width:c.width,height:c.height});d.screen_location.width=c.width;d.screen_location.height=c.height},_frame_grid:function(e,c,d){e.grid_location=c;this._frame_offset(e,this._to_pixel(c),d);e.grid_rank=this._location_rank(c)},_frame_screen:function(d){var c=d.screen_location;return{top:c.top,left:c.left,width:c.width,height:c.height}},_template:function(){return'<div class="galaxy-frame"></div>'},_template_frame:function(f,e,c,d){if(!e){e=""}if(c=="url"){d='<iframe scrolling="auto" class="f-iframe" src="'+d+'"></iframe>'}return'<div id="'+f+'" class="frame corner"><div class="f-header corner"><span class="f-title">'+e+'</span><span class="f-icon f-pin fa fa-thumb-tack"></span><span class="f-icon f-close fa fa-trash-o"></span></div><div class="f-content">'+d+'<div class="f-cover"></div></div><span class="f-resize f-icon corner fa fa-resize-full"></span></div>'},_template_shadow:function(c){return'<div id="'+c+'" class="frame-shadow corner"></div>'},_template_background:function(){return'<div class="frame-background"></div>'},_template_menu:function(){return'<div class="frame-scroll-up frame-menu fa fa-chevron-up fa-2x"></div><div class="frame-scroll-down frame-menu fa fa-chevron-down fa-2x"></div>'}});return{GalaxyFrame:a}}); \ No newline at end of file +define(["galaxy.masthead","libs/backbone/backbone-relational"],function(b){var a=Backbone.View.extend({el_main:"body",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:9},cols:0,top:0,top_max:0,frame_z:0,frame_counter:0,frame_counter_id:0,frame_list:[],frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(d){var c=this;this.button_active=new b.GalaxyMastheadIcon({icon:"fa-th",tooltip:"Enable/Disable Scratchbook",on_click:function(f){c._event_panel_active(f)},on_unload:function(){if(c.frame_counter>0){return"You opened "+c.frame_counter+" frame(s) which will be lost."}}});Galaxy.masthead.append(this.button_active);this.button_load=new b.GalaxyMastheadIcon({icon:"fa-eye",tooltip:"Show/Hide Scratchbook",on_click:function(f){c._event_panel_load(f)},with_number:true});Galaxy.masthead.append(this.button_load);if(d){this.options=_.defaults(d,this.options)}this.top=this.top_max=this.options.top_min;this.setElement(this._template());$(this.el).append(this._template_background());$(this.el).append(this._template_menu());$(this.el_main).append($(this.el));var e="#frame-shadow";$(this.el).append(this._template_shadow(e.substring(1)));this.frame_shadow={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this._frame_resize(this.frame_shadow,{width:0,height:0});this.frame_list[e]=this.frame_shadow;this._panel_refresh();var c=this;$(window).resize(function(){if(c.visible){c._panel_refresh()}})},add:function(d){var g={title:"",content:null,target:"",type:null,scratchbook:false};if(d){d=_.defaults(d,g)}else{d=g}if(!d.content){return}if(d.target=="_blank"){window.open(d.content);return}if(d.target=="_top"||d.target=="_parent"||d.target=="_self"){window.location=d.content;return}if(!this.active){var f=$(window.parent.document).find("#galaxy_main");if(d.target=="galaxy_main"||d.target=="center"){if(f.length==0){var c=d.content;if(c.indexOf("?")==-1){c+="?"}else{c+="&"}c+="use_panels=True";window.location=c}else{f.attr("src",d.content)}}else{window.location=d.content}return}if(this.frame_counter>=this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var e="#frame-"+(this.frame_counter_id++);if($(e).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this._template_frame(e.substring(1),d.title,d.type,d.content));var h={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};d.width=this._to_pixel_coord("width",this.options.frame.cols);d.height=this._to_pixel_coord("height",this.options.frame.rows);this.frame_z=parseInt($(h.id).css("z-index"));this.frame_list[e]=h;this.frame_counter++;this._frame_resize(h,{width:d.width,height:d.height});this._frame_insert(h,{top:0,left:0},true);if(!this.visible){this._panel_show_hide()}},event:{type:null,target:null,xy:null},events:{mousemove:"_event_frame_mouse_move",mouseup:"_event_frame_mouse_up",mouseleave:"_event_frame_mouse_up",mousewheel:"_event_panel_scroll",DOMMouseScroll:"_event_panel_scroll","mousedown .frame":"_event_frame_mouse_down","mousedown .frame-background":"_event_panel_load","mousedown .frame-scroll-up":"_event_panel_scroll_up","mousedown .frame-scroll-down":"_event_panel_scroll_down","mousedown .f-close":"_event_frame_close","mousedown .f-pin":"_event_frame_lock"},_event_frame_mouse_down:function(c){if(this.event.type!==null){return}if($(c.target).hasClass("f-header")||$(c.target).hasClass("f-title")){this.event.type="drag"}if($(c.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}c.preventDefault();this.event.target=this._frame_identify(c.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:c.originalEvent.pageX,y:c.originalEvent.pageY};this._frame_drag_start(this.event.target)},_event_frame_mouse_move:function(i){if(this.event.type!="drag"&&this.event.type!="resize"){return}var g={x:i.originalEvent.pageX,y:i.originalEvent.pageY};var d={x:g.x-this.event.xy.x,y:g.y-this.event.xy.y};this.event.xy=g;var h=this._frame_screen(this.event.target);if(this.event.type=="resize"){h.width+=d.x;h.height+=d.y;var f=this.options.cell-this.options.margin-1;h.width=Math.max(h.width,f);h.height=Math.max(h.height,f);this._frame_resize(this.event.target,h);h.width=this._to_grid_coord("width",h.width)+1;h.height=this._to_grid_coord("height",h.height)+1;h.width=this._to_pixel_coord("width",h.width);h.height=this._to_pixel_coord("height",h.height);this._frame_resize(this.frame_shadow,h);this._frame_insert(this.frame_shadow,{top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)})}if(this.event.type=="drag"){h.left+=d.x;h.top+=d.y;this._frame_offset(this.event.target,h);var c={top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)};if(c.left!==0){c.left++}this._frame_insert(this.frame_shadow,c)}},_event_frame_mouse_up:function(c){if(this.event.type!="drag"&&this.event.type!="resize"){return}this._frame_drag_stop(this.event.target);this.event.type=null},_event_frame_close:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this._frame_identify(d.target);var c=this;$(f.id).fadeOut("fast",function(){$(f.id).remove();delete c.frame_list[f.id];c.frame_counter--;c._panel_refresh(true);c._panel_animation_complete();if(c.visible&&c.frame_counter==0){c._panel_show_hide()}})},_event_frame_lock:function(c){if(this.event.type!==null){return}c.preventDefault();var d=this._frame_identify(c.target);if(d.grid_lock){d.grid_lock=false;$(d.id).find(".f-pin").removeClass("toggle");$(d.id).find(".f-header").removeClass("f-not-allowed");$(d.id).find(".f-title").removeClass("f-not-allowed");$(d.id).find(".f-resize").show();$(d.id).find(".f-close").show()}else{d.grid_lock=true;$(d.id).find(".f-pin").addClass("toggle");$(d.id).find(".f-header").addClass("f-not-allowed");$(d.id).find(".f-title").addClass("f-not-allowed");$(d.id).find(".f-resize").hide();$(d.id).find(".f-close").hide()}},_event_panel_load:function(c){if(this.event.type!==null){return}this._panel_show_hide()},_event_panel_active:function(c){if(this.event.type!==null){return}this._panel_active_disable()},_event_panel_scroll:function(c){if(this.event.type!==null||!this.visible){return}c.preventDefault();var d=c.originalEvent.detail?c.originalEvent.detail:c.originalEvent.wheelDelta/-3;this._panel_scroll(d)},_event_panel_scroll_up:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(-this.options.scroll)},_event_panel_scroll_down:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(this.options.scroll)},_frame_identify:function(c){return this.frame_list["#"+$(c).closest(".frame").attr("id")]},_frame_drag_start:function(d){this._frame_focus(d,true);var c=this._frame_screen(d);this._frame_resize(this.frame_shadow,c);this._frame_grid(this.frame_shadow,d.grid_location);d.grid_location=null;$(this.frame_shadow.id).show();$(".f-cover").show()},_frame_drag_stop:function(d){this._frame_focus(d,false);var c=this._frame_screen(this.frame_shadow);this._frame_resize(d,c);this._frame_grid(d,this.frame_shadow.grid_location,true);this.frame_shadow.grid_location=null;$(this.frame_shadow.id).hide();$(".f-cover").hide();this._panel_animation_complete()},_to_grid_coord:function(e,d){var c=(e=="width"||e=="height")?1:-1;if(e=="top"){d-=this.top}return parseInt((d+c*this.options.margin)/this.options.cell,10)},_to_pixel_coord:function(e,f){var c=(e=="width"||e=="height")?1:-1;var d=(f*this.options.cell)-c*this.options.margin;if(e=="top"){d+=this.top}return d},_to_grid:function(c){return{top:this._to_grid_coord("top",c.top),left:this._to_grid_coord("left",c.left),width:this._to_grid_coord("width",c.width),height:this._to_grid_coord("height",c.height)}},_to_pixel:function(c){return{top:this._to_pixel_coord("top",c.top),left:this._to_pixel_coord("left",c.left),width:this._to_pixel_coord("width",c.width),height:this._to_pixel_coord("height",c.height)}},_is_collision:function(e){function c(h,g){return !(h.left>g.left+g.width-1||h.left+h.width-1<g.left||h.top>g.top+g.height-1||h.top+h.height-1<g.top)}for(var d in this.frame_list){var f=this.frame_list[d];if(f.grid_location===null){continue}if(c(e,f.grid_location)){return true}}return false},_location_rank:function(c){return(c.top*this.cols)+c.left},_menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".frame-scroll-up").hide()}else{$(".frame-scroll-up").show()}if(this.top==this.top_max){$(".frame-scroll-down").hide()}else{$(".frame-scroll-down").show()}},_panel_animation_complete:function(){var c=this;$(".frame").promise().done(function(){c._panel_scroll(0,true)})},_panel_refresh:function(c){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this._frame_insert(null,null,c)},_panel_scroll:function(h,c){var e=this.top-this.options.scroll*h;e=Math.max(e,this.top_max);e=Math.min(e,this.options.top_min);if(this.top!=e){for(var d in this.frame_list){var g=this.frame_list[d];if(g.grid_location!==null){var f={top:g.screen_location.top-(this.top-e),left:g.screen_location.left};this._frame_offset(g,f,c)}}this.top=e}this._menu_refresh()},_panel_show_hide:function(){if(this.visible){this.visible=false;$(".frame").fadeOut("fast");this.button_load.icon("fa-eye-slash");this.button_load.untoggle();$(".frame-background").hide();$(".frame-menu").hide()}else{this.visible=true;$(".frame").fadeIn("fast");this.button_load.icon("fa-eye");this.button_load.toggle();$(this.frame_shadow.id).hide();$(".frame-background").show();this._panel_refresh()}},_panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this._panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},_frame_insert:function(j,c,e){var d=[];if(j){j.grid_location=null;d.push([j,this._location_rank(c)])}var g=null;for(g in this.frame_list){var h=this.frame_list[g];if(h.grid_location!==null&&!h.grid_lock){h.grid_location=null;d.push([h,h.grid_rank])}}d.sort(function(k,f){var m=k[1];var l=f[1];return m<l?-1:(m>l?1:0)});for(g=0;g<d.length;g++){this._frame_place(d[g][0],e)}this.top_max=0;for(var g in this.frame_list){var j=this.frame_list[g];if(j.grid_location!==null){this.top_max=Math.max(this.top_max,j.grid_location.top+j.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this._menu_refresh()},_frame_place:function(k,d){k.grid_location=null;var h=this._to_grid(this._frame_screen(k));var c=false;for(var f=0;f<this.options.rows;f++){for(var e=0;e<Math.max(1,this.cols-h.width);e++){h.top=f;h.left=e;if(!this._is_collision(h)){c=true;break}}if(c){break}}if(c){this._frame_grid(k,h,d)}else{console.log("Grid dimensions exceeded.")}},_frame_focus:function(e,c){var d=this.frame_z+(c?1:0);$(e.id).css("z-index",d)},_frame_offset:function(f,e,d){f.screen_location.left=e.left;f.screen_location.top=e.top;if(d){this._frame_focus(f,true);var c=this;$(f.id).animate({top:e.top,left:e.left},"fast",function(){c._frame_focus(f,false)})}else{$(f.id).css({top:e.top,left:e.left})}},_frame_resize:function(d,c){$(d.id).css({width:c.width,height:c.height});d.screen_location.width=c.width;d.screen_location.height=c.height},_frame_grid:function(e,c,d){e.grid_location=c;this._frame_offset(e,this._to_pixel(c),d);e.grid_rank=this._location_rank(c)},_frame_screen:function(d){var c=d.screen_location;return{top:c.top,left:c.left,width:c.width,height:c.height}},_template:function(){return'<div class="galaxy-frame"></div>'},_template_frame:function(f,e,c,d){if(!e){e=""}if(c=="url"){d='<iframe scrolling="auto" class="f-iframe" src="'+d+'"></iframe>'}return'<div id="'+f+'" class="frame corner"><div class="f-header corner"><span class="f-title">'+e+'</span><span class="f-icon f-pin fa fa-thumb-tack"></span><span class="f-icon f-close fa fa-trash-o"></span></div><div class="f-content">'+d+'<div class="f-cover"></div></div><span class="f-resize f-icon corner fa fa-resize-full"></span></div>'},_template_shadow:function(c){return'<div id="'+c+'" class="frame-shadow corner"></div>'},_template_background:function(){return'<div class="frame-background"></div>'},_template_menu:function(){return'<div class="frame-scroll-up frame-menu fa fa-chevron-up fa-2x"></div><div class="frame-scroll-down frame-menu fa fa-chevron-down fa-2x"></div>'}});return{GalaxyFrame:a}}); \ No newline at end of file diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/packed/galaxy.master.js --- a/static/scripts/packed/galaxy.master.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["utils/galaxy.utils","libs/backbone/backbone-relational"],function(c){var a=Backbone.View.extend({el_master:"#everything",options:null,list:{},itemLast:null,itemCounter:0,$background:null,backgroundVisible:false,initialize:function(f){this.options=f;$("body").off();this.setElement($(this._template(f)));$(this.el_master).append($(this.el));this.$background=$(this.el).find("#master-background");var e=this;window.onbeforeunload=function(){var h="";for(key in e.list){if(e.list[key].options.on_unload){var g=e.list[key].options.on_unload();if(g){h+=g+" "}}}if(h!=""){return h}}},events:{click:"_eventRefresh",mousedown:function(f){f.preventDefault()}},append:function(e){return this._add(e,true)},prepend:function(e){return this._add(e,false)},_add:function(g,f){var e=$(this.el).find("#"+g.masterLocation);if(e){var h="master-item-"+this.itemCounter++;var i=$(g.el);i.attr("id",h);i.addClass("master-item");if(f){e.append(i)}else{e.prepend(i)}this.list[h]=g;return h}return null},_eventRefresh:function(h){var i=$(h.target).closest(".master-item");if(i.length){i=i.attr("id")}if(this.itemLast&&this.itemLast!=i){var g=this.list[this.itemLast];if(g){if(g.masterReset){g.masterReset()}}}var f=false;if(i){var g=this.list[i];if(g){if(g.masterReset){if(this.itemLast==i){f=this.backgroundVisible?false:true}else{f=true}}}}if(f){this.$background.show()}else{this.$background.hide()}this.backgroundVisible=f;this.itemLast=i},_templateItem:function(e){return'<div id="'+e+'" class="master-item"></div>'},_template:function(e){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+e.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+e.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="master-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var d=Backbone.View.extend({options:{id:"galaxy-icon",icon:"fa-cog",tooltip:"galaxy-icon",with_number:false,on_click:function(){alert("clicked")},on_unload:null,visible:true},masterLocation:"iconbar",initialize:function(f){if(f){this.options=_.defaults(f,this.options)}this.setElement($(this._template(this.options)));var e=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip}).on("mouseup",e.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(e){$(this.el).find(".icon").removeClass(this.options.icon).addClass(e);this.options.icon=e},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(e){$(this.el).find(".number").text(e)},_template:function(f){var e="<div id="+f.id+' class="symbol"><div class="icon fa fa-2x '+f.icon+'"></div>';if(f.with_number){e+='<div class="number"></div>'}e+="</div>";return e}});var b=Backbone.View.extend({options:{id:"",title:"Title",target:"_parent",content:"",type:"url",scratchbook:false,on_unload:null,visible:true},masterLocation:"navbar",$menu:null,menuVisible:false,events:{"click .head":"_eventClickHead"},initialize:function(e){if(e){this.options=_.defaults(e,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},addMenu:function(g){var h={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(g){h=_.defaults(g,h)}if(h.content&&h.content.indexOf("//")===-1){h.content=galaxy_config.root+h.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".menu")}var f=$(this._templateMenuItem(h));this.$menu.append(f);var e=this;f.on("click",function(i){i.preventDefault();e._hideMenu();if(e.options.target==="_blank"){return true}Galaxy.frame.add(g)});if(h.divider){this.$menu.append($(this._templateDivider()))}},masterReset:function(){this._hideMenu()},_hideMenu:function(){if(this.$menu&&this.menuVisible){this.$menu.hide();this.menuVisible=false}},_eventClickHead:function(f){f.preventDefault();if(this.$menu){if(!this.menuVisible){this.$menu.show();this.menuVisible=true}else{this.$menu.hide();this.menuVisible=false}}else{Galaxy.frame.add(this.options)}},_templateMenuItem:function(e){return'<li><a href="'+e.content+'" target="'+e.target+'">'+e.title+"</a></li>"},_templateMenu:function(){return'<ul class="menu dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(f){var e='<ul class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+f.target+'" href="'+f.content+'">'+f.title+'<b class="symbol"></b></a></li></ul>';return e}});return{GalaxyMaster:a,GalaxyMasterTab:b,GalaxyMasterIcon:d}}); \ No newline at end of file diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/packed/galaxy.masthead.js --- /dev/null +++ b/static/scripts/packed/galaxy.masthead.js @@ -0,0 +1,1 @@ +define(["utils/galaxy.utils","libs/backbone/backbone-relational"],function(c){var a=Backbone.View.extend({el_masthead:"#everything",options:null,list:{},itemLast:null,itemCounter:0,$background:null,backgroundVisible:false,initialize:function(f){this.options=f;$("body").off();this.setElement($(this._template(f)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var e=this;window.onbeforeunload=function(){var h="";for(key in e.list){if(e.list[key].options.on_unload){var g=e.list[key].options.on_unload();if(g){h+=g+" "}}}if(h!=""){return h}}},events:{click:"_eventRefresh",mousedown:function(f){f.preventDefault()}},append:function(e){return this._add(e,true)},prepend:function(e){return this._add(e,false)},_add:function(g,f){var e=$(this.el).find("#"+g.mastheadLocation);if(e){var h="masthead-item-"+this.itemCounter++;var i=$(g.el);i.attr("id",h);i.addClass("masthead-item");if(f){e.append(i)}else{e.prepend(i)}this.list[h]=g;return h}return null},_eventRefresh:function(h){var i=$(h.target).closest(".masthead-item");if(i.length){i=i.attr("id")}if(this.itemLast&&this.itemLast!=i){var g=this.list[this.itemLast];if(g){if(g.mastheadReset){g.mastheadReset()}}}var f=false;if(i){var g=this.list[i];if(g){if(g.mastheadReset){if(this.itemLast==i){f=this.backgroundVisible?false:true}else{f=true}}}}if(f){this.$background.show()}else{this.$background.hide()}this.backgroundVisible=f;this.itemLast=i},_templateItem:function(e){return'<div id="'+e+'" class="masthead-item"></div>'},_template:function(e){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+e.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+e.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"galaxy-icon",icon:"fa-cog",tooltip:"galaxy-icon",with_number:false,on_click:function(){alert("clicked")},on_unload:null,visible:true},mastheadLocation:"iconbar",initialize:function(f){if(f){this.options=_.defaults(f,this.options)}this.setElement($(this._template(this.options)));var e=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip}).on("mouseup",e.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(e){$(this.el).find(".icon").removeClass(this.options.icon).addClass(e);this.options.icon=e},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(e){$(this.el).find(".number").text(e)},_template:function(f){var e="<div id="+f.id+' class="symbol"><div class="icon fa fa-2x '+f.icon+'"></div>';if(f.with_number){e+='<div class="number"></div>'}e+="</div>";return e}});var d=Backbone.View.extend({options:{id:"",title:"Title",target:"_parent",content:"",type:"url",scratchbook:false,on_unload:null,visible:true},mastheadLocation:"navbar",$menu:null,menuVisible:false,events:{"click .head":"_eventClickHead"},initialize:function(e){if(e){this.options=_.defaults(e,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},addMenu:function(g){var h={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(g){h=_.defaults(g,h)}if(h.content&&h.content.indexOf("//")===-1){h.content=galaxy_config.root+h.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".menu")}var f=$(this._templateMenuItem(h));this.$menu.append(f);var e=this;f.on("click",function(i){i.preventDefault();e._hideMenu();if(e.options.target==="_blank"){return true}Galaxy.frame.add(g)});if(h.divider){this.$menu.append($(this._templateDivider()))}},mastheadReset:function(){this._hideMenu()},_hideMenu:function(){if(this.$menu&&this.menuVisible){this.$menu.hide();this.menuVisible=false}},_eventClickHead:function(f){f.preventDefault();if(this.$menu){if(!this.menuVisible){this.$menu.show();this.menuVisible=true}else{this.$menu.hide();this.menuVisible=false}}else{Galaxy.frame.add(this.options)}},_templateMenuItem:function(e){return'<li><a href="'+e.content+'" target="'+e.target+'">'+e.title+"</a></li>"},_templateMenu:function(){return'<ul class="menu dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(f){var e='<ul class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+f.target+'" href="'+f.content+'">'+f.title+'<b class="symbol"></b></a></li></ul>';return e}});return{GalaxyMasthead:a,GalaxyMastheadTab:d,GalaxyMastheadIcon:b}}); \ No newline at end of file diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/packed/galaxy.menu.js --- /dev/null +++ b/static/scripts/packed/galaxy.menu.js @@ -0,0 +1,1 @@ +define(["galaxy.masthead","libs/backbone/backbone-relational"],function(b){var a=Backbone.Model.extend({options:null,masthead:null,initialize:function(c){this.options=c.config;this.masthead=c.masthead;this.create()},create:function(){var d=new b.GalaxyMastheadTab({title:"Analyze Data",content:"root/index"});this.masthead.append(d);var c=new b.GalaxyMastheadTab({title:"Workflow",content:"workflow"});this.masthead.append(c);var g=new b.GalaxyMastheadTab({title:"Shared Data",content:"library/index"});g.addMenu({title:"Data Libraries",content:"library/index",divider:true});g.addMenu({title:"Published Histories",content:"history/list_published"});g.addMenu({title:"Published Workflows",content:"workflow/list_published"});g.addMenu({title:"Published Visualizations",content:"visualization/list_published"});g.addMenu({title:"Published Pages",content:"page/list_published"});this.masthead.append(g);if(this.options.user.requests){var h=new b.GalaxyMastheadTab({title:"Lab"});h.addMenu({title:"Sequencing Requests",content:"requests/index"});h.addMenu({title:"Find Samples",content:"requests/find_samples_index"});h.addMenu({title:"Help",content:this.options.lims_doc_url});this.masthead.append(h)}var k=new b.GalaxyMastheadTab({title:"Visualization",content:"visualization/list"});k.addMenu({title:"New Track Browser",content:"visualization/trackster",target:"_frame"});k.addMenu({title:"Saved Visualizations",content:"visualization/list",target:"_frame"});this.masthead.append(k);if(this.options.enable_cloud_launch){var e=new b.GalaxyMastheadTab({title:"Cloud",content:"cloudlaunch/index"});e.addMenu({title:"New Cloud Cluster",content:"cloudlaunch/index"});this.masthead.append(e)}if(this.options.is_admin_user){var f=new b.GalaxyMastheadTab({title:"Admin",content:"admin/index",extra_class:"admin-only"});this.masthead.append(f)}var j=new b.GalaxyMastheadTab({title:"Help"});if(this.options.biostar_url){j.addMenu({title:"Galaxy Q&A Site",content:this.options.biostar_url_redirect,target:"_blank"});j.addMenu({title:"Ask a question",content:"biostar/biostar_question_redirect",target:"_blank"})}j.addMenu({title:"Support",content:this.options.support_url,target:"_blank"});j.addMenu({title:"Search",content:this.options.search_url,target:"_blank"});j.addMenu({title:"Mailing Lists",content:this.options.mailing_lists,target:"_blank"});j.addMenu({title:"Videos",content:this.options.screencasts_url,target:"_blank"});j.addMenu({title:"Wiki",content:this.options.wiki_url,target:"_blank"});j.addMenu({title:"How to Cite Galaxy",content:this.options.citation_url,target:"_blank"});if(!this.options.terms_url){j.addMenu({title:"Terms and Conditions",content:this.options.terms_url,target:"_blank"})}this.masthead.append(j);if(!this.options.user.valid){var i=new b.GalaxyMastheadTab({title:"User",extra_class:"loggedout-only"});if(this.options.allow_user_creation){i.addMenu({title:"Login",content:"user/login",target:"galaxy_main"})}if(this.options.allow_user_creation){i.addMenu({title:"Register",content:"user/create",target:"galaxy_main"})}this.masthead.append(i)}else{var i=new b.GalaxyMastheadTab({title:"User",extra_class:"loggedin-only"});i.addMenu({title:"Logged in as "+this.options.user.email});if(this.options.use_remote_user&&this.options.remote_user_logout_href){i.addMenu({title:"Logout",content:this.options.remote_user_logout_href,target:"_top"})}else{i.addMenu({title:"Preferences",content:"user?cntrller=user",target:"galaxy_main"});i.addMenu({title:"Custom Builds",content:"user/dbkeys",target:"galaxy_main"});i.addMenu({title:"Logout",content:"user/logout",target:"_top",divider:true})}i.addMenu({title:"Saved Histories",content:"history/list",target:"galaxy_main"});i.addMenu({title:"Saved Datasets",content:"dataset/list",target:"galaxy_main"});i.addMenu({title:"Saved Pages",content:"page/list",target:"_top"});i.addMenu({title:"API Keys",content:"user/api_keys?cntrller=user",target:"galaxy_main"});if(this.options.use_remote_user){i.addMenu({title:"Public Name",content:"user/edit_username?cntrller=user",target:"galaxy_main"})}this.masthead.append(i)}}});return{GalaxyMenu:a}}); \ No newline at end of file diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 static/scripts/packed/galaxy.upload.js --- a/static/scripts/packed/galaxy.upload.js +++ b/static/scripts/packed/galaxy.upload.js @@ -1,1 +1,1 @@ -define(["galaxy.modal","galaxy.master","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,d,c){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],state:{init:"fa fa-trash-o",queued:"fa fa-spinner fa-spin",running:"__running__",success:"fa fa-check",error:"fa fa-exclamation-triangle"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}var e=this;this.button_show=new d.GalaxyMasterIcon({icon:"fa-arrow-circle-o-up",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},on_unload:function(){if(e.counter.running>0){return"Several uploads are still processing."}},with_number:true});Galaxy.master.prepend(this.button_show);var e=this;c.jsonFromUrl(galaxy_config.root+"api/datatypes",function(f){for(key in f){e.select_extension.push([f[key],f[key]])}});c.jsonFromUrl(galaxy_config.root+"api/genomes",function(f){var g=e.select_genome[0];e.select_genome=[];for(key in f){if(f[key].length>1){if(f[key][1]!==g[1]){e.select_genome.push(f[key])}}}e.select_genome.sort(function(i,h){return i[0]>h[0]?1:i[0]<h[0]?-1:0});e.select_genome.unshift(g)})},event_dragover:function(f){},event_dragleave:function(f){},event_announce:function(i,g,n){var f="#upload-"+i;$(this.el).find("tbody:last").append(this.template_row(f));var h=this.get_upload_item(i);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var m=this;h.find("#symbol").on("click",function(){m.event_remove(i)});h.find("#text-content").on("keyup",function(){var o=h.find("#text-content").val().length;h.find("#size").html(m.size_to_string(o))});this.event_progress(i,g,0);this.counter.announce++;this.update_screen();if(g.size==-1){var l=h.find("#text");var j=8;var e=h.width()-2*j;var k=h.height()-j;l.css("width",e+"px");l.css("top",k+"px");h.height(k+l.height()+2*j);l.show()}},event_initialize:function(i,e,n){this.button_show.number(this.counter.announce);var g=this.get_upload_item(i);var k=g.find("#symbol");k.addClass(this.state.running);var j=Galaxy.currHistoryPanel.model.get("id");var f=g.find("#extension").val();var m=g.find("#genome").val();var l=g.find("#text-content").val();var h=g.find("#space_to_tabs").is(":checked");if(!l&&!(e.size>0)){return null}this.uploadbox.configure({url:galaxy_config.root+"api/tools",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=m;tool_input.file_type=f;tool_input["files_0|NAME"]=e.name;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=l;tool_input.space_to_tabs=h;data={};data.history_id=j;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refreshHdas()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_start:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#text-content").attr("disabled",true);$(this).find("#genome").attr("disabled",true);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.start()},event_stop:function(){if(this.counter.running==0){return}this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#text-content").attr("disabled",false);$(this).find("#genome").attr("disabled",false);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_create:function(){this.uploadbox.add([{name:"New File",size:-1}])},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Create:function(){f.event_create()},Upload:function(){f.event_start()},Pause:function(){f.event_stop()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:function(){f.event_dragover()},dragleave:function(){f.event_dragleave()},announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{if(e>0){e=e*10;f="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(f){var e='<tr id="'+f.substr(1)+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';e+='<td><select id="extension" class="extension">';for(key in this.select_extension){e+='<option value="'+this.select_extension[key][1]+'">'+this.select_extension[key][0]+"</option>"}e+="</select></td>";e+='<td><select id="genome" class="genome">';for(key in this.select_genome){e+='<option value="'+this.select_genome[key][1]+'">'+this.select_genome[key][0]+"</option>"}e+="</select></td>";e+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}}); \ No newline at end of file +define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","utils/galaxy.uploadbox","libs/backbone/backbone-relational"],function(b,c,d){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],state:{init:"fa fa-trash-o",queued:"fa fa-spinner fa-spin",running:"__running__",success:"fa fa-check",error:"fa fa-exclamation-triangle"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}var e=this;this.button_show=new c.GalaxyMastheadIcon({icon:"fa-arrow-circle-o-up",tooltip:"Upload Files",on_click:function(f){e.event_show(f)},on_unload:function(){if(e.counter.running>0){return"Several uploads are still processing."}},with_number:true});Galaxy.masthead.prepend(this.button_show);var e=this;d.jsonFromUrl(galaxy_config.root+"api/datatypes",function(f){for(key in f){e.select_extension.push([f[key],f[key]])}});d.jsonFromUrl(galaxy_config.root+"api/genomes",function(f){var g=e.select_genome[0];e.select_genome=[];for(key in f){if(f[key].length>1){if(f[key][1]!==g[1]){e.select_genome.push(f[key])}}}e.select_genome.sort(function(i,h){return i[0]>h[0]?1:i[0]<h[0]?-1:0});e.select_genome.unshift(g)})},event_dragover:function(f){},event_dragleave:function(f){},event_announce:function(i,g,n){var f="#upload-"+i;$(this.el).find("tbody:last").append(this.template_row(f));var h=this.get_upload_item(i);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var m=this;h.find("#symbol").on("click",function(){m.event_remove(i)});h.find("#text-content").on("keyup",function(){var o=h.find("#text-content").val().length;h.find("#size").html(m.size_to_string(o))});this.event_progress(i,g,0);this.counter.announce++;this.update_screen();if(g.size==-1){var l=h.find("#text");var j=8;var e=h.width()-2*j;var k=h.height()-j;l.css("width",e+"px");l.css("top",k+"px");h.height(k+l.height()+2*j);l.show()}},event_initialize:function(i,e,n){this.button_show.number(this.counter.announce);var g=this.get_upload_item(i);var k=g.find("#symbol");k.addClass(this.state.running);var j=Galaxy.currHistoryPanel.model.get("id");var f=g.find("#extension").val();var m=g.find("#genome").val();var l=g.find("#text-content").val();var h=g.find("#space_to_tabs").is(":checked");if(!l&&!(e.size>0)){return null}this.uploadbox.configure({url:galaxy_config.root+"api/tools",paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=m;tool_input.file_type=f;tool_input["files_0|NAME"]=e.name;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=l;tool_input.space_to_tabs=h;data={};data.history_id=j;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refreshHdas()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_start:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#text-content").attr("disabled",true);$(this).find("#genome").attr("disabled",true);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.start()},event_stop:function(){if(this.counter.running==0){return}this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#text-content").attr("disabled",false);$(this).find("#genome").attr("disabled",false);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_create:function(){this.uploadbox.add([{name:"New File",size:-1}])},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Create:function(){f.event_create()},Upload:function(){f.event_start()},Pause:function(){f.event_stop()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:function(){f.event_dragover()},dragleave:function(){f.event_dragleave()},announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{if(e>0){e=e*10;f="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(f){var e='<tr id="'+f.substr(1)+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';e+='<td><select id="extension" class="extension">';for(key in this.select_extension){e+='<option value="'+this.select_extension[key][1]+'">'+this.select_extension[key][0]+"</option>"}e+="</select></td>";e+='<td><select id="genome" class="genome">';for(key in this.select_genome){e+='<option value="'+this.select_genome[key][1]+'">'+this.select_genome[key][0]+"</option>"}e+="</select></td>";e+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}}); \ No newline at end of file diff -r 0e7ecc1418ea4f31d4c20a8c0ccc97f6558c41ee -r 91c9b4fb1c0660e4940ccb507b6f8cc5a3ad3f92 templates/webapps/galaxy/galaxy.masthead.mako --- a/templates/webapps/galaxy/galaxy.masthead.mako +++ b/templates/webapps/galaxy/galaxy.masthead.mako @@ -25,11 +25,11 @@ %></%def> -## master head generator +## masthead head generator <%def name="load()"><% ## get configuration - master_config = { + masthead_config = { ## inject configuration 'brand' : app.config.get("brand", ""), 'use_remote_user' : app.config.use_remote_user, @@ -70,37 +70,37 @@ $('<link href="' + galaxy_config.root + 'static/style/galaxy.frame.masthead.css" rel="stylesheet">').appendTo('head'); ## load galaxy js-modules - require(['galaxy.master', 'galaxy.menu', 'galaxy.modal', 'galaxy.frame', 'galaxy.upload'], - function(mod_master, mod_menu, mod_modal, mod_frame, mod_upload) + require(['galaxy.masthead', 'galaxy.menu', 'galaxy.modal', 'galaxy.frame', 'galaxy.upload'], + function(mod_masthead, mod_menu, mod_modal, mod_frame, mod_upload) { - ## check if master is available - if (Galaxy.master) + ## check if masthead is available + if (Galaxy.masthead) return; ## get configuration - var master_config = ${ h.to_json_string( master_config ) }; + var masthead_config = ${ h.to_json_string( masthead_config ) }; ## set up the quota meter (And fetch the current user data from trans) - Galaxy.currUser = new User(master_config.user.json); + Galaxy.currUser = new User(masthead_config.user.json); ## load global galaxy objects - Galaxy.master = new mod_master.GalaxyMaster(master_config); + Galaxy.masthead = new mod_masthead.GalaxyMasthead(masthead_config); Galaxy.modal = new mod_modal.GalaxyModal(); Galaxy.frame = new mod_frame.GalaxyFrame(); ## construct default menu options Galaxy.menu = new mod_menu.GalaxyMenu({ - master: Galaxy.master, - config: master_config + masthead: Galaxy.masthead, + config: masthead_config }); ## add upload plugin ##Galaxy.upload = new mod_upload.GalaxyUpload(); - ## add quota meter to master + ## add quota meter to masthead Galaxy.quotaMeter = new UserQuotaMeter({ model : Galaxy.currUser, - el : $(Galaxy.master.el).find('.quota-meter-container') + el : $(Galaxy.masthead.el).find('.quota-meter-container') }).render(); }); </script> 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.