fix a problem after reloading the page the date tags couldn't be deleted
authornowmad@nowmads-macbook-pro.local
Wed, 20 Jan 2016 13:04:27 +0100
changeset 89 89be68e13215
parent 88 1547a32aef60
child 90 f0609941aa98
fix a problem after reloading the page the date tags couldn't be deleted
cms/app-client/app/controllers/application.js
--- a/cms/app-client/app/controllers/application.js	Wed Jan 20 10:38:09 2016 +0100
+++ b/cms/app-client/app/controllers/application.js	Wed Jan 20 13:04:27 2016 +0100
@@ -48,16 +48,18 @@
   }),
   actions: {
     deleteTag: function(query, item){
-      var queryParams = {},
-          newParams = null;
+      var newParams = null;
+
       if (query === 'date'){
-        newParams = this.get('date');
-        if(newParams.indexOf(item) !== -1) {
-        	newParams = newParams.splice(newParams.indexOf(item), 1);
-        }
+        newParams = [];
+        Ember.$.each(this.get('date'), function(index, elt){
+          if (elt !== item){
+            newParams.push(elt);
+          }
+        });
       }
-      queryParams[query] = newParams;
-      this.transitionToRoute({queryParams: queryParams});
+
+      this.set(query, newParams);
     },
     changeSong: function(songDirection){
       var direction = (songDirection === "next") ? 1 : -1;