diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-23 00:57:42 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-23 00:57:59 (GMT) |
commit | 2f3936cbd917d03afb6525dcf7deee6feb73e426 (patch) | |
tree | 7dfa0f009ac9e06594b6f1f5ce01513f98db99b5 /www/js | |
parent | 83067ca7cb512cd76db625e5db9d08dd385df8e3 (diff) |
changed <select> based show selector to bootstrap dropdown
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/shows.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/www/js/shows.js b/www/js/shows.js index f125991..233a5c3 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -96,7 +96,7 @@ Rdxport.ShowListView.prototype.updateSelector = function() { var $showSelector = $('#show-selector'); $showSelector.off(); - $('option', $showSelector).remove(); + $('li', $showSelector).remove(); $(this.model.groups).sort(function(a, b) { if(a.title.toLowerCase() == b.title.toLowerCase()) { @@ -104,9 +104,16 @@ Rdxport.ShowListView.prototype.updateSelector = function() { } 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)); + var name = show.id + ' | <strong>' + show.title + '</strong> (' + show.rhythm + ', ' + weekday[show.dayofweek] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; + var link = $('<a>').attr('href', '#').html(name).click(function() { + self.setCurrentShowId(show.id); + self.getCurrentShowView().model.fetchCarts(); + }); + $showSelector.append($('<li>').append(link)); }); + if($showSelector.children().length == 0) { + $showSelector.append($('<li>').append($('<a>').text('Keine Sendung gefunden!'))); + } // todo: maybe integrate this into setCurrentShowId? if (!this.currentShowId) { @@ -117,12 +124,6 @@ Rdxport.ShowListView.prototype.updateSelector = function() { this.setCurrentShowId(this.model.groups[0].id); } } - $('option[value="' + this.currentShowId + '"]', $showSelector).attr('selected', 'selected'); - - $showSelector.on('change', function() { - self.setCurrentShowId($('option:selected', $showSelector).attr('value')); - self.getCurrentShowView().model.fetchCarts(); - }); this.getCurrentShowView().model.fetchCarts(); }; |