forked from Archives/Athou_commafeed
added unsubscribe link
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user