Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created August 26, 2014 16:32
Show Gist options
  • Save lefnire/52681718a5a63f5e91c5 to your computer and use it in GitHub Desktop.
Save lefnire/52681718a5a63f5e91c5 to your computer and use it in GitHub Desktop.
diff --git a/public/js/controllers/filtersCtrl.js b/public/js/controllers/filtersCtrl.js
index 8f665ea..172406a 100644
--- a/public/js/controllers/filtersCtrl.js
+++ b/public/js/controllers/filtersCtrl.js
@@ -41,9 +41,10 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User',
ui.item.sortable.cancel();
},
stop: function(e, ui) {
- User.user.ops.sortTag({
- query: {from: ui.item.sortable.index, to:ui.item.sortable.dropindex}
- });
+ var from = ui.item.sortable.index,
+ to = ui.item.sortable.dropindex;
+ if (from == to) return;
+ User.user.ops.sortTag({query:{from:from, to:to}});
},
axis: 'x',
//distance: 5
diff --git a/public/js/controllers/tasksCtrl.js b/public/js/controllers/tasksCtrl.js
index 24a5dae..f43abd8 100644
--- a/public/js/controllers/tasksCtrl.js
+++ b/public/js/controllers/tasksCtrl.js
@@ -90,10 +90,10 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
ui.item.sortable.cancel();
},
stop: function(e, ui) {
- User.user.ops.sortTask({
- params: {id: ui.item.scope().task.id},
- query: {from: ui.item.sortable.index, to:ui.item.sortable.dropindex}
- });
+ var from = ui.item.sortable.index,
+ to = ui.item.sortable.dropindex;
+ if (from == to) return;
+ User.user.ops.sortTask({params: {id: ui.item.scope().task.id}, query: {from:from, to:to}});
},
axis: 'y',
//distance: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment