diff --git a/src/main/webapp/directives/category.html b/src/main/webapp/directives/category.html index 43625c5f..8f7e33c3 100644 --- a/src/main/webapp/directives/category.html +++ b/src/main/webapp/directives/category.html @@ -11,7 +11,7 @@ diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js index cd6f6c11..f9109e91 100644 --- a/src/main/webapp/js/directives.js +++ b/src/main/webapp/js/directives.js @@ -56,6 +56,21 @@ module.directive('category', function($compile) { format-category-name="formatCategoryName({category:category})" format-feed-name="formatFeedName({feed:feed})">\ '); $compile(ul.contents())(scope); + }, + controller: function($scope, $dialog, SubscriptionService) { + $scope.unsubscribe = function(subscription) { + var title = 'Unsubscribe'; + var msg = 'Unsubscribe from ' + subscription.name + ' ?'; + var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}]; + + $dialog.messageBox(title, msg, btns) + .open() + .then(function(result){ + if(result == 'ok'){ + SubscriptionService.unsubscribe(subscription.id); + } + }); + } } }; });