diff --git a/src/main/webapp/directives/category.html b/src/main/webapp/directives/category.html
index 2f05c4a0..0d97eed8 100644
--- a/src/main/webapp/directives/category.html
+++ b/src/main/webapp/directives/category.html
@@ -16,19 +16,16 @@
-
- {{formatCategoryName({category:node})}}
+
+ {{formatCategoryName(node)}}
-
- {{formatFeedName({feed:feed})}}
+ {{formatFeedName(feed)}}
diff --git a/src/main/webapp/js/controllers.js b/src/main/webapp/js/controllers.js
index 86860634..6cfa3176 100644
--- a/src/main/webapp/js/controllers.js
+++ b/src/main/webapp/js/controllers.js
@@ -138,45 +138,6 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
$window.document.title = label;
});
- $scope.formatCategoryName = function(category) {
- var count = $scope.unreadCount(category);
- var label = category.name;
- if (count > 0) {
- label = label + ' (' + count + ')';
- }
- return label;
- };
-
- $scope.formatFeedName = function(feed) {
- var label = feed.name;
- if (feed.unread > 0) {
- label = label + ' (' + feed.unread + ')';
- }
- return label;
- };
-
- $scope.feedClicked = function(id) {
- if ($scope.selectedType == 'feed' && id == $scope.selectedId) {
- $scope.$emit('emitReload');
- } else {
- $state.transitionTo('feeds.view', {
- _type : 'feed',
- _id : id
- });
- }
- };
-
- $scope.categoryClicked = function(id) {
- if ($scope.selectedType == 'category' && id == $scope.selectedId) {
- $scope.$emit('emitReload');
- } else {
- $state.transitionTo('feeds.view', {
- _type : 'category',
- _id : id
- });
- }
- };
-
var mark = function(node, entry) {
var i;
if (node.children) {
diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js
index d6c4b67c..f9e0f7c5 100644
--- a/src/main/webapp/js/directives.js
+++ b/src/main/webapp/js/directives.js
@@ -71,22 +71,18 @@ module.directive('recursive', ['$compile', function($compile) {
};
}]);
-module.directive('category', ['$compile', function($compile) {
+module.directive('category', [function() {
return {
scope : {
node : '=',
selectedType : '=',
selectedId : '=',
- feedClick : '&',
- categoryClick : '&',
unreadCount : '&',
- formatCategoryName : '&',
- formatFeedName : '&'
},
restrict : 'E',
replace : true,
templateUrl : 'directives/category.html',
- controller : function($scope, $dialog, FeedService, CategoryService,
+ controller : function($scope, $state, $dialog, FeedService, CategoryService,
SettingsService) {
$scope.settingsService = SettingsService;
$scope.unsubscribe = function(subscription) {
@@ -113,6 +109,45 @@ module.directive('category', ['$compile', function($compile) {
}
});
};
+
+ $scope.formatCategoryName = function(category) {
+ var count = $scope.unreadCount({category:category});
+ var label = category.name;
+ if (count > 0) {
+ label = label + ' (' + count + ')';
+ }
+ return label;
+ };
+
+ $scope.formatFeedName = function(feed) {
+ var label = feed.name;
+ if (feed.unread > 0) {
+ label = label + ' (' + feed.unread + ')';
+ }
+ return label;
+ };
+
+ $scope.feedClicked = function(id) {
+ if ($scope.selectedType == 'feed' && id == $scope.selectedId) {
+ $scope.$emit('emitReload');
+ } else {
+ $state.transitionTo('feeds.view', {
+ _type : 'feed',
+ _id : id
+ });
+ }
+ };
+
+ $scope.categoryClicked = function(id) {
+ if ($scope.selectedType == 'category' && id == $scope.selectedId) {
+ $scope.$emit('emitReload');
+ } else {
+ $state.transitionTo('feeds.view', {
+ _type : 'category',
+ _id : id
+ });
+ }
+ };
$scope.renameFeed = function(feed) {
var name = window.prompt('Rename feed : ', feed.name);
diff --git a/src/main/webapp/templates/_tree.html b/src/main/webapp/templates/_tree.html
index 0e2dc735..0f9721ec 100644
--- a/src/main/webapp/templates/_tree.html
+++ b/src/main/webapp/templates/_tree.html
@@ -1,10 +1,7 @@
\ No newline at end of file