don't refresh menu when changing categories

This commit is contained in:
Athou
2013-03-22 23:54:52 +01:00
parent 38f893d976
commit 8a6f843604
3 changed files with 42 additions and 36 deletions

View File

@@ -9,8 +9,25 @@
</head>
<body>
<div ng-app="commafeed">
<div class="container-fluid">
<div class="row-fluid">
<div class="span2" ng-controller="CategoryTreeCtrl">
<div class="css-treeview">
<ul>
<category node="root" feed-click="feedClicked(id)"
category-click="categoryClicked(id)" selected-type="selectedType"
selected-id="selectedId"
format-category-name="formatCategoryName(category)"
format-feed-name="formatFeedName(feed)"> </category>
</ul>
</div>
</div>
<div class="span10">
<ng:view></ng:view>
</div>
</div>
</div>
</div>
<script src="vendor/jquery/jquery-1.9.1.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>

View File

@@ -9,8 +9,10 @@ module.run(function($rootScope) {
module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
CategoryService) {
$scope.$on('$routeChangeSuccess', function() {
$scope.selectedType = $routeParams._type;
$scope.selectedId = $routeParams._id;
});
$scope.root = CategoryService.get();
@@ -48,10 +50,14 @@ module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
}
$scope.feedClicked = function(id) {
$scope.selectedType = 'feed';
$scope.selectedId = id;
$location.path('/feeds/view/feed/' + id);
};
$scope.categoryClicked = function(id) {
$scope.selectedType = 'category';
$scope.selectedId = id;
$location.path('/feeds/view/category/' + id);
};

View File

@@ -1,17 +1,4 @@
<div class="container-fluid">
<div class="row-fluid">
<div class="span2" ng-controller="CategoryTreeCtrl">
<div class="css-treeview">
<ul>
<category node="root" feed-click="feedClicked(id)"
category-click="categoryClicked(id)" selected-type="selectedType"
selected-id="selectedId"
format-category-name="formatCategoryName(category)"
format-feed-name="formatFeedName(feed)"> </category>
</ul>
</div>
</div>
<div class="span10" ng-controller="FeedListCtrl">
<div ng-controller="FeedListCtrl">
<span>{{entryList.name}}</span><span
ng-show="selectedType == 'category'"> &#187;</span>
<div class="accordion" id="feed-accordion">
@@ -31,7 +18,3 @@
</div>
</div>
</div>
</div>
</div>