From ecb289de62a82a087df3fea11d4cbed47cb4bedb Mon Sep 17 00:00:00 2001
From: Peter Grassberger <petertheone@gmail.com>
Date: Wed, 16 Dec 2015 17:30:37 +0100
Subject: jingle: clear dom before render


diff --git a/www/js/jingles.js b/www/js/jingles.js
index aa982a1..496b7b3 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -48,6 +48,7 @@ var JingleGroupList = function() {
 
 JingleGroupList.prototype.fetch = function() {
   this.groups = [];
+  $('#app-jingles .groups').html('');
 
   var self = this;
   rivendell.listDropboxes(function(groupsXml, status, req) {
@@ -72,15 +73,11 @@ JingleGroupList.prototype.fetch = function() {
   });
 };
 
-JingleGroupList.prototype.render = function() {
-  $('#app-jingles .groups').html('');
-  $(this.groups).each(function(index, group) {
-    group.render();
-  });
-};
-
 JingleGroupList.prototype.destroy = function() {
   // todo: implement
+  $(this.groups).each(function(index, group) {
+    group.destroy();
+  });
 };
 
 var JingleGroup = function(title, groupName, description, lowcart, highcart, normlevel, trimlevel) {
@@ -172,6 +169,10 @@ JingleGroup.prototype.renderCarts = function() {
   }
 };
 
+JingleGroup.prototype.destroy = function() {
+  $('table > tbody', this.$el).html('');
+};
+
 /*JingleGroup.prototype.addUpload = function() {
   var $tfoot = $('table > tfoot', this.$el);
   var $progressBar = $('.progressBarTemplate').clone().removeClass('progressBarTemplate');
-- 
cgit v0.10.2