added unsubscribe link

This commit is contained in:
Athou
2013-03-24 16:39:45 +01:00
parent 5f7b3fa46d
commit 842c7faea4
2 changed files with 16 additions and 1 deletions

View File

@@ -11,7 +11,7 @@
<a dropdown-toggle class="pull-right feed-menu-icon"><i class="icon icon-chevron-down"></i> </a>
<ul class="dropdown-menu">
<li>
<a>Unsubscribe</a>
<a ng-click="unsubscribe(feed)">Unsubscribe</a>
</li>
</ul>
</div>

View File

@@ -56,6 +56,21 @@ module.directive('category', function($compile) {
format-category-name="formatCategoryName({category:category})" format-feed-name="formatFeedName({feed:feed})">\
</category>');
$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);
}
});
}
}
};
});