From 59fc2787322aea11bd2a09fc2254ebb26161b729 Mon Sep 17 00:00:00 2001
From: Peter Grassberger <petertheone@gmail.com>
Date: Sun, 31 Jan 2016 18:07:57 +0100
Subject: musicgrid: fix no re-render bug, etc.


diff --git a/www/js/musicgrid.js b/www/js/musicgrid.js
index bd219ff..e751b6c 100644
--- a/www/js/musicgrid.js
+++ b/www/js/musicgrid.js
@@ -87,7 +87,11 @@ Rivendell.MusicgridView.prototype.update = function() {
   });
 
   $('tr td:not(.clock)', this.$el).off().on('click', function() {
-    musicpoolModal.selectClock($(this).parent().data('dow'), $(this).data('hour'), null);
+    musicpoolModal.selectClock(
+        $(this).parent().data('dow'),
+        $(this).data('hour'),
+        null
+    );
   });
 };
 
@@ -106,7 +110,8 @@ Rivendell.MusicpoolModal.prototype.selectClock = function(dow, hour, clockName)
   $('tbody', $modalBody).html('');
 
   var self = this;
-  $(this.model).on('update', function() {
+  $(this.model).off().on('update', function() {
+    $('tbody tr', $modalBody).remove();
     $(self.model.groups).each(function(index, musicpool) {
       var $button = null;
       if (clockName === musicpool.clock) {
@@ -118,7 +123,7 @@ Rivendell.MusicpoolModal.prototype.selectClock = function(dow, hour, clockName)
       $button.on('click', function() {
         rivendell.setMusicgrid(dow, hour, musicpool.clock, function() {
           $('#musicpoolModal').modal('hide');
-          musicgridView.modal.fetch();
+          musicgridView.model.fetch();
         });
       });
 
diff --git a/www/js/rivendell.js b/www/js/rivendell.js
index 8566094..1a00f07 100644
--- a/www/js/rivendell.js
+++ b/www/js/rivendell.js
@@ -456,6 +456,4 @@ Rivendell.Cut = function(name, description, cart, length, originDatetime,
   }
   this.number = this.name.substr(-3);
   this.cartNumber = this.cart.number;
-
-
 };
-- 
cgit v0.10.2