summaryrefslogtreecommitdiff
path: root/www/js/todo.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/todo.js')
-rw-r--r--www/js/todo.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/www/js/todo.js b/www/js/todo.js
index 84f5b33..f576d91 100644
--- a/www/js/todo.js
+++ b/www/js/todo.js
@@ -46,7 +46,7 @@ rh.ShowList.prototype.fetch = function() {
this.current_week = get_rd_week(this.current.valueOf());
this.request_sent = true;
- self.$this.trigger('update-hdr');
+ self.$this.trigger('pre-update');
$.getJSON( "/rh-bin/schedules.json?DAYS=1&START=" + format_date_iso(this.current), function(data) {
if(data.status == "OK") {
history.replaceState(null, null, '/todo/' + format_date_iso(self.current));
@@ -102,11 +102,13 @@ rh.ShowListView = function(model) {
this.showViews = [];
var self = this;
- $(this.model).on('update-hdr', function() {
+ $(this.model).on('pre-update', function() {
self.render_hdr();
+ self.render_loading();
});
$(this.model).on('update', function() {
- self.render();
+ self.render_hdr();
+ self.render_list();
});
this.model.fetch();
};
@@ -131,22 +133,26 @@ rh.ShowListView.prototype.render_hdr = function() {
default:
weekspan.addClass('label-default').text('Fehler');
}
+};
+rh.ShowListView.prototype.render_list = function() {
+ $('#loading').hide();
var list = $('#shows');
$('div.show', list).remove();
this.showViews = [];
-};
-
-rh.ShowListView.prototype.render = function() {
- this.render_hdr();
- var list = $('#shows');
for (var i = 0; i < this.model.shows.length; i++) {
var showView = new rh.ShowView(this.model.shows[i], this);
this.showViews.push(showView);
showView.render();
list.append(showView.$el);
}
+ list.show();
+};
+
+rh.ShowListView.prototype.render_loading = function() {
+ $('#shows').hide();
+ $('#loading').show();
};