diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-22 22:05:35 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-22 22:06:38 (GMT) |
commit | 83067ca7cb512cd76db625e5db9d08dd385df8e3 (patch) | |
tree | 8c6076cc295fcaf81db4c7fe7c317e48688c862a /www | |
parent | 1338103170bf4b2b116f0a0134db86459c176f9a (diff) |
sorting show and musicpool names for selector
Diffstat (limited to 'www')
-rw-r--r-- | www/js/musicpools.js | 4 | ||||
-rw-r--r-- | www/js/shows.js | 9 | ||||
-rw-r--r-- | www/js/utils.js | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index ac5a07e..9d21427 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -98,7 +98,9 @@ Rdxport.MusicpoolsView.prototype.updateSelector = function() { $musicpoolSelector.off(); $('option', $musicpoolSelector).remove(); - $(this.model.groups).each(function(index, musicpool) { + $(this.model.groups).sort(function(a, b) { + return a.title.toLowerCase() >= b.title.toLowerCase() + }).each(function(index, musicpool) { var name = musicpool.title + ' (' + musicpool.clock + ')'; $musicpoolSelector.append($('<option>').attr('value', musicpool.clock).text(name)); }); diff --git a/www/js/shows.js b/www/js/shows.js index 9104bec..f125991 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -98,8 +98,13 @@ Rdxport.ShowListView.prototype.updateSelector = function() { $showSelector.off(); $('option', $showSelector).remove(); - $(this.model.groups).each(function(index, show) { - var name = show.title + ' (' + show.rhythm + ', ' + weekday[show.dayofweek] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; + $(this.model.groups).sort(function(a, b) { + if(a.title.toLowerCase() == b.title.toLowerCase()) { + return b.rhythm - a.rhythm; + } + return a.title.toLowerCase() >= b.title.toLowerCase() + }).each(function(index, show) { + var name = show.id + ' | ' + show.title + ' (' + show.rhythm + ', ' + weekday[show.dayofweek] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; $showSelector.append($('<option>').attr('value', show.id).text(name)); }); diff --git a/www/js/utils.js b/www/js/utils.js index eaed673..7e7a656 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -141,6 +141,10 @@ jQuery.fn.brightness = function() { } }; +jQuery.fn.sort = function() { + return this.pushStack(jQuery.makeArray([].sort.apply(this, arguments))); +}; + function updateProgressBar($el, upload) { if(upload.uploadprogress.progress < 99) { var bytes_str = Number((upload.uploadprogress.bytesSent/1024)/1024).toFixed(1) + " von " + |