diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/musicpools.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 9d21427..5b3d491 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -96,14 +96,21 @@ Rdxport.MusicpoolsView.prototype.updateSelector = function() { var $musicpoolSelector = $('#musicpool-selector'); $musicpoolSelector.off(); - $('option', $musicpoolSelector).remove(); + $('li', $musicpoolSelector).remove(); $(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)); + var name = '<strong>' + musicpool.title + '</strong> (' + musicpool.clock + ')'; + var link = $('<a>').attr('href', '#').html(name).click(function() { + self.setCurrentPoolId(musicpool.clock); + self.getCurrentPoolView().model.fetchCarts(); + }); + $musicpoolSelector.append($('<li>').append(link)); }); + if($musicpoolSelector.children().length == 0) { + $musicpoolSelector.append($('<li>').append($('<a>').text('Keinen Musikpool gefunden!'))); + } // todo: maybe integrate this into setCurrentShowId? if (!this.currentPoolId) { @@ -114,12 +121,6 @@ Rdxport.MusicpoolsView.prototype.updateSelector = function() { this.setCurrentPoolId(this.model.groups[0].id); } } - $('option[value="' + this.currentPoolId + '"]', $musicpoolSelector).attr('selected', 'selected'); - - $musicpoolSelector.on('change', function() { - self.setCurrentPoolId($('option:selected', $musicpoolSelector).attr('value')); - self.getCurrentPoolView().model.fetchCarts(); - }); this.getCurrentPoolView().model.fetchCarts(); }; @@ -156,7 +157,7 @@ Rdxport.MusicpoolView.prototype.render = function() { this.$el = $('#hiddenTemplates .musicpoolTemplate').clone().removeClass('musicpoolTemplate'); $('#app-musicpools .musicpoolContainer').html(this.$el); - $('h2', this.$el).text(this.model.title); + $('#musicpool-title').text(this.model.title); $('table tbody tr', this.$el).remove(); this.cartViews = []; |