mark all as read

This commit is contained in:
Athou
2013-03-25 21:01:29 +01:00
parent 2c3a5274be
commit fa83a6a903
9 changed files with 81 additions and 27 deletions

View File

@@ -27,14 +27,34 @@
}
/* entry list*/
.entry {
#feed-accordion .entry {
border-bottom: 1px solid #CCCCCC;
}
.entry:hover {
.no-entries {
text-align: center;
font-weight: bold;
margin-top: 80px;
}
.entry .entry-heading a {
padding: 6px 0px;
background-color: #EBEBEB;
}
.entry .entry-heading a.collapsed {
background-color: #FFF;
}
.entry .entry-heading a.collapsed:hover {
background-color: #EBEBEB;
}
.entry .entry-heading a ~.collapsed {
background-color: #EBEBEB;
padding: 6px 0px;
}
.entry a {
color: black;
display: block;

View File

@@ -7,7 +7,7 @@
</div>
<button type="button" class="btn" ng-click="refresh()"><i class="icon-refresh"></i> Refresh</button>
<button type="button" class="btn"><i class="icon-ok"></i> Mark all as read</button>
<button type="button" class="btn" ng-click="markAllAsRead()"><i class="icon-ok"></i> Mark all as read</button>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="settings"><i class="icon-cog"></i><span class="caret"></span></a>

View File

@@ -152,9 +152,9 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
entry : entry
});
EntryService.mark({
_type : 'entry',
_id : entry.id,
_readtype : read
type : 'entry',
id : entry.id,
read : read
});
}
};

View File

@@ -89,7 +89,7 @@ module.directive('category', function($compile) {
};
});
module.directive('toolbar', function(SettingsService) {
module.directive('toolbar', function($routeParams, $route, SettingsService, EntryService, SubscriptionService) {
return {
scope : {},
restrict : 'E',
@@ -99,6 +99,17 @@ module.directive('toolbar', function(SettingsService) {
$scope.settings = SettingsService.settings;
$scope.refresh = function() {
$route.reload();
},
$scope.markAllAsRead = function() {
EntryService.mark({
type: $routeParams._type,
id: $routeParams._id,
read: true,
}, function() {
SubscriptionService.init(function() {
$route.reload();
});
});
}
},
link : function($scope, element) {

View File

@@ -41,9 +41,10 @@ module.factory('SubscriptionService', [ '$resource', '$http',
s.flatCategories = {};
var res = $resource('rest/subscriptions/:_method', {}, actions);
s.init = function() {
s.subscriptions = res.get(function(){
s.init = function(callback) {
s.subscriptions = res.get(function(data) {
s.flatCategories = flatten(s.subscriptions);
callback(data);
});
};
s.subscribe = function(sub, callback) {

View File

@@ -2,10 +2,10 @@
{{readType}}
<span>{{entryList.name}}</span><span
ng-show="selectedType == 'category'"> &#187;</span>
<div class="accordion" id="feed-accordion" infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1">
<div id="feed-accordion" infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1">
<div ng-repeat="entry in entryList.entries" class="entry">
<div class="entry-heading">
<a class="accordion-toggle" data-toggle="collapse"
<a class="accordion-toggle collapsed" data-toggle="collapse"
ng-click="mark(entry, true)"
ng-class="{unread: entry.read == false}"
data-parent="#feed-accordion" href="{{'#feed-body' + $index}}">
@@ -24,6 +24,7 @@
</div>
</div>
</div>
<div class="no-entries" ng-show="entryList.entries.length == 0">"{{entryList.name}}" has no unread items.</div>
<div ng-show="busy">Loading data...</div>
</div>
</div>