summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-01-16 06:15:41 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-01-16 06:15:41 (GMT)
commit7ca592a6d8378eb5474c6ee4935f157ee1f546d0 (patch)
tree5805e04bece479ec2d04b058674f402285cd3a6a /www/js
parent86e72f4a3432798dafb196be0ac84c50582724c1 (diff)
show loading screen
Diffstat (limited to 'www/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();
};