commit/galaxy-central: guerler: Sort genomes in genome selector
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ecd1fe4c471d/ Changeset: ecd1fe4c471d User: guerler Date: 2013-10-16 05:40:46 Summary: Sort genomes in genome selector Affected #: 1 file diff -r 443c97b1017eae9374ab91c0d87a19252db8a0e0 -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 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_util) { +define(["galaxy.modal", "galaxy.master", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master, mod_utils) { // galaxy upload var GalaxyUpload = Backbone.View.extend( @@ -18,14 +18,10 @@ uploadbox: null, // extension types - select_extension : { - 'auto' : 'Auto-detect' - }, + select_extension :[['Auto-detect', 'auto']], // genomes - select_genome : { - '?' : 'Unspecified' - }, + select_genome : [['Unspecified (?)', '?']], // states state : { @@ -85,17 +81,32 @@ // load extension var self = this; - mod_util.jsonFromUrl(galaxy_config.root + "api/datatypes", + mod_utils.jsonFromUrl(galaxy_config.root + "api/datatypes", function(datatypes) { for (key in datatypes) - self.select_extension[datatypes[key]] = datatypes[key]; + self.select_extension.push([datatypes[key], datatypes[key]]); }); // load genomes - mod_util.jsonFromUrl(galaxy_config.root + "api/genomes", + mod_utils.jsonFromUrl(galaxy_config.root + "api/genomes", function(genomes) { + // backup default + var def = self.select_genome[0]; + + // fill array + self.select_genome = []; for (key in genomes) - self.select_genome[genomes[key][1]] = genomes[key][0]; + if (genomes[key].length > 1) + if (genomes[key][1] !== def[1]) + self.select_genome.push(genomes[key]); + + // sort + self.select_genome.sort(function(a, b) { + return a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0; + }); + + // insert default back to array + self.select_genome.unshift(def); }); }, @@ -565,7 +576,7 @@ tmpl += '<td>' + '<select id="extension" class="extension">'; for (key in this.select_extension) - tmpl += '<option value="' + key + '">' + this.select_extension[key] + '</option>'; + tmpl += '<option value="' + this.select_extension[key][1] + '">' + this.select_extension[key][0] + '</option>'; tmpl += '</select>' + '</td>'; @@ -573,7 +584,7 @@ tmpl += '<td>' + '<select id="genome" class="genome">'; for (key in this.select_genome) - tmpl += '<option value="' + key + '">' + this.select_genome[key] + '</option>'; + tmpl += '<option value="' + this.select_genome[key][1] + '">' + this.select_genome[key][0] + '</option>'; tmpl += '</select>' + '</td>'; Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org