starring support (#43)

This commit is contained in:
Athou
2013-04-30 11:29:02 +02:00
parent 2cbf51c287
commit bfde9241eb
8 changed files with 55 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ public class Entry implements Serializable {
entry.setUrl(feedEntry.getUrl());
entry.setRead(status.isRead());
entry.setStarred(status.isStarred());
entry.setFeedName(status.getSubscription().getTitle());
entry.setFeedId(String.valueOf(status.getSubscription().getId()));

View File

@@ -212,6 +212,19 @@
font-size: 12px;
}
#feed-accordion .star {
text-decoration: none;
padding: 0px 5px;
}
#feed-accordion .icon-star-yellow {
color: gold;
}
#feed-accordion .icon-star-empty {
color: #555;
}
/* admin */
.admin .users-table {
height: 400px;

View File

@@ -1,5 +1,5 @@
<li>
<div ng-mouseenter="hovered=node" ng-mouseleave="hovered=null" class="pointer">
<div ng-mouseenter="hovered=node" ng-mouseleave="hovered=null" class="pointer" ui-if="showLabel">
<div class="dropdown pull-right">
<a data-toggle="dropdown" class="pull-right">
<i ng-class="{'icon-chevron-down': hovered==node && node.id != 'all'}" class="icon"></i>
@@ -13,19 +13,19 @@
</li>
</ul>
</div>
<span class="fldr" ng-click="toggleCategory(node)">
<i ng-class="{'icon-caret-right': !node.expanded, 'icon-caret-down': node.expanded}"></i>
<span class="fldr">
<i ng-class="{'icon-caret-right': !node.expanded, 'icon-caret-down': node.expanded}" ng-click="toggleCategory(node)" ng-show="showChildren"></i>
</span>
<span ng-click="categoryClicked(node.id)">
<span ng-class="{selected: (node.id == selectedId && selectedType == 'category'), unread: unreadCount({category:node})}">{{formatCategoryName(node)}}
</span>
</span>
</div>
<ul ng-show="node.expanded" class="indent">
<ul ng-show="node.expanded && showChildren" ng-class="{indent: showLabel}">
<recursive>
<category ng-repeat="child in node.children" ng-show="settingsService.settings.showRead == true || unreadCount({category:node}) > 0"
node="child" selected-type="selectedType"
selected-id="selectedId"
selected-id="selectedId" show-label="true" show-children="true"
unread-count="unreadCount({category:category})">
</category>
</recursive>

View File

@@ -99,6 +99,11 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
$scope.selectedType = $stateParams._type;
$scope.selectedId = $stateParams._id;
$scope.starred = {
id: 'starred',
name: 'Starred'
};
$scope.$on('$stateChangeSuccess', function() {
$scope.selectedType = $stateParams._type;
$scope.selectedId = $stateParams._id;
@@ -339,6 +344,18 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
});
}
};
$scope.star = function(entry, star, event) {
event.preventDefault();
event.stopPropagation();
if (entry.starred != star) {
entry.starred = star;
EntryService.star({
id : entry.id,
starred : star
});
}
};
$scope.isOpen = false;
$scope.entryClicked = function(entry, event) {

View File

@@ -95,6 +95,8 @@ module.directive('category', [ function() {
node : '=',
selectedType : '=',
selectedId : '=',
showLabel : '=',
showChildren : '=',
unreadCount : '&'
},
restrict : 'E',

View File

@@ -186,6 +186,12 @@ function($resource, $http) {
params : {
_method : 'mark'
}
},
star : {
method : 'POST',
params : {
_method : 'star'
}
}
};
var res = $resource('rest/entry/:_method', {}, actions);

View File

@@ -1,6 +1,12 @@
<div class="css-treeview" ng-controller="CategoryTreeCtrl">
<ul>
<category node="CategoryService.subscriptions"
<category node="CategoryService.subscriptions" show-label="true" show-children="false"
selected-type="selectedType" selected-id="selectedId"
unread-count="unreadCount(category)"> </category>
<category node="starred" show-label="true" show-children="false"
selected-type="selectedType" selected-id="selectedId"
unread-count="unreadCount(category)"> </category>
<category node="CategoryService.subscriptions" show-label="false" show-children="true"
selected-type="selectedType" selected-id="selectedId"
unread-count="unreadCount(category)"> </category>
</ul>

View File

@@ -9,6 +9,10 @@
<a href="{{entry.url}}" target="_blank" class="entry-heading" ng-click="noop($event)" ng-mouseup="entryClicked(entry, $event)"
ng-class="{open: current == entry, closed: current != entry}">
<span class="feed-name">
<span class="star" ng-mouseup="star(entry, !entry.starred, $event)">
<i ng-class="{'icon-star icon-star-yellow': entry.starred, 'icon-star-empty': !entry.starred}"
class="pointer"></i>
</span>
<favicon url="entry.feedUrl" />
{{entry.feedName}}
</span>