2013-03-21 16:22:58 +01:00
|
|
|
var module = angular.module('commafeed.directives', []);
|
|
|
|
|
|
|
|
|
|
module.directive('category', function($compile) {
|
|
|
|
|
return {
|
|
|
|
|
scope: {
|
|
|
|
|
node: '=',
|
|
|
|
|
selectedType: '=',
|
|
|
|
|
selectedId: '=',
|
|
|
|
|
feedClick: '&',
|
2013-03-21 23:10:05 +01:00
|
|
|
categoryClick: '&',
|
2013-03-22 07:31:15 +01:00
|
|
|
formatCategoryName: '&',
|
|
|
|
|
formatFeedName: '&'
|
2013-03-21 16:22:58 +01:00
|
|
|
},
|
|
|
|
|
restrict : 'E',
|
|
|
|
|
replace: true,
|
|
|
|
|
templateUrl: 'directives/category.html',
|
|
|
|
|
link: function(scope, element) {
|
2013-03-22 22:11:40 +01:00
|
|
|
var ul = element.find('ul');
|
|
|
|
|
ul.prepend('<category ng-repeat="child in node.children" node="child" feed-click="feedClick({id:id})" \
|
|
|
|
|
category-click="categoryClick({id:id})" selected-type="selectedType" selected-id="selectedId" \
|
|
|
|
|
format-category-name="formatCategoryName({category:category})" format-feed-name="formatFeedName({feed:feed})">\
|
|
|
|
|
</category>');
|
|
|
|
|
$compile(ul.contents())(scope);
|
2013-03-21 16:22:58 +01:00
|
|
|
}
|
|
|
|
|
};
|
2013-03-23 23:14:14 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.directive('toolbar', function(SettingsService) {
|
|
|
|
|
return {
|
|
|
|
|
scope : {},
|
|
|
|
|
restrict : 'E',
|
|
|
|
|
replace : true,
|
|
|
|
|
templateUrl : 'directives/toolbar.html',
|
|
|
|
|
controller : function($scope, SettingsService) {
|
|
|
|
|
$scope.settings = SettingsService.settings;
|
|
|
|
|
},
|
|
|
|
|
link : function($scope, element) {
|
|
|
|
|
element.find('button').bind('click', function() {
|
|
|
|
|
SettingsService.save();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
2013-03-21 16:22:58 +01:00
|
|
|
});
|