diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-23 03:24:09 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-23 03:24:55 (GMT) |
commit | add9b76db60093be8d680e28ca190fba479179fb (patch) | |
tree | d87f00bd5907751285eee242c1c59b8a2f2cb703 /www/js | |
parent | 2f3936cbd917d03afb6525dcf7deee6feb73e426 (diff) |
changed <select> based music pool selector to bootstrap dropdown
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 = []; |