option to force refresh all feeds

This commit is contained in:
Athou
2013-07-27 11:21:26 +02:00
parent da94880c53
commit 37437877e1
5 changed files with 40 additions and 5 deletions

View File

@@ -248,6 +248,19 @@ public class FeedREST extends AbstractResourceREST {
return Response.ok(info).build();
}
@Path("/refreshAll")
@GET
@ApiOperation(value = "Queue all feeds of the user for refresh", notes = "Manually add all feeds of the user to the refresh queue")
public Response queueAllForRefresh() {
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(getUser());
for (FeedSubscription sub : subs) {
Feed feed = sub.getFeed();
feed.setUrgent(true);
taskGiver.add(feed);
}
return Response.ok(Status.OK).build();
}
@Path("/refresh")
@POST
@ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue")
@@ -264,7 +277,6 @@ public class FeedREST extends AbstractResourceREST {
return Response.ok(Status.OK).build();
}
return Response.ok(Status.NOT_FOUND).build();
}
@Path("/mark")

View File

@@ -31,6 +31,7 @@ toolbar.all=All
toolbar.previous_entry=Previous entry
toolbar.next_entry=Next entry
toolbar.refresh=Refresh
toolbar.refresh_all=Force refresh all my feeds
toolbar.sort_by_asc_desc=Sort by date asc/desc
toolbar.titles_only=Titles only
toolbar.expanded_view=Expanded view

View File

@@ -18,7 +18,8 @@ module.run(['$rootScope', function($rootScope) {
$rootScope.$broadcast('markAll', args);
});
$rootScope.$on('emitReload', function(event, args) {
$rootScope.$broadcast('reload');
// args.all
$rootScope.$broadcast('reload', args);
});
$rootScope.$on('emitFeedSearch', function(event, args) {
$rootScope.$broadcast('feedSearch');
@@ -469,7 +470,12 @@ function($scope, $http, $state, $stateParams, $route, $location,
$scope.refresh = function() {
$scope.$emit('emitReload');
};
$scope.refreshAll = function() {
$scope.$emit('emitReload', {
all : true
});
};
var markAll = function(olderThan) {
@@ -1140,7 +1146,9 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
$scope.hasMore = true;
$scope.loadMoreEntries();
if ($scope.selectedType == 'feed'){
if (args.all) {
FeedService.refreshAll();
} else if ($scope.selectedType == 'feed') {
FeedService.refresh({
id : $stateParams._id
});

View File

@@ -92,6 +92,12 @@ function($resource, $http) {
_method : 'refresh'
}
},
refreshAll : {
method : 'GET',
params : {
_method : 'refreshAll'
}
},
subscribe : {
method : 'POST',
params : {

View File

@@ -9,7 +9,15 @@
<div class="btn-group">
<a type="button" class="btn" ng-click="previousEntry()" title="${toolbar.previous_entry}"><i class="icon-chevron-up"></i></a>
<a type="button" class="btn" ng-click="nextEntry()" title="${toolbar.next_entry}"><i class="icon-chevron-down"></i></a>
<a type="button" class="btn" ng-click="refresh()" title="${toolbar.refresh}"><i class="icon-refresh"></i></a>
<div class="btn-group">
<a type="button" class="btn" ng-click="refresh()" title="${toolbar.refresh}"><i class="icon-refresh"></i></a>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a ng-click="refreshAll()">${toolbar.refresh_all}</a></li>
</ul>
</div>
</div>
<div class="btn-group">