diff options
Diffstat (limited to 'coffee/directives/droppable.coffee')
-rw-r--r-- | coffee/directives/droppable.coffee | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/coffee/directives/droppable.coffee b/coffee/directives/droppable.coffee new file mode 100644 index 000000000..37b29fca1 --- /dev/null +++ b/coffee/directives/droppable.coffee @@ -0,0 +1,33 @@ +### +# ownCloud - News app +# +# @author Bernhard Posselt +# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> +# +# This file is licensed under the Affero General Public License version 3 or later. +# See the COPYING-README file +# +### + +angular.module('News').directive 'droppable', ['$rootScope', ($rootScope) -> + + return (scope, elm, attr) -> + $elem = $(elm) + + details = + accept: '.feed' + hoverClass: 'dnd_over' + greedy: true + drop: (event, ui) -> + # in case jquery ui did something weird + $('.dnd_over').removeClass('dnd_over') + + data = + folderId: parseInt($elem.data('id'), 10) + feedId: parseInt($(ui.draggable).data('id'), 10) + + $rootScope.$broadcast('moveFeedToFolder', data) + scope.$apply attr.droppable + + $elem.droppable(details) +]
\ No newline at end of file |