toolbar navigation icons

This commit is contained in:
Athou
2013-05-17 16:33:58 +02:00
parent 680b0551fc
commit 54841a92de
3 changed files with 33 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ new_category.parent=Parent
toolbar.unread=Unread
toolbar.all=All
toolbar.previous_entry=Previous entry
toolbar.next_entry=Next entry
toolbar.refresh=Refresh
toolbar.sort_by_asc_desc=Sort by date asc/desc
toolbar.mark_all_as_read=Mark all as read

View File

@@ -1,6 +1,12 @@
var module = angular.module('commafeed.controllers', []);
module.run(['$rootScope', function($rootScope) {
$rootScope.$on('emitPreviousEntry', function(event, args) {
$rootScope.$broadcast('previousEntry', args);
});
$rootScope.$on('emitNextEntry', function(event, args) {
$rootScope.$broadcast('nextEntry', args);
});
$rootScope.$on('emitMark', function(event, args) {
// args.entry - the entry
$rootScope.$broadcast('mark', args);
@@ -381,6 +387,15 @@ function($scope, $http, $state, $stateParams, $route, $location,
$scope.$emit('emitReload');
}
});
$scope.previousEntry = function() {
$scope.$emit('emitPreviousEntry');
};
$scope.nextEntry = function() {
$scope.$emit('emitNextEntry');
};
$scope.refresh = function() {
if($stateParams._type == 'feed'){
FeedService.refresh({
@@ -580,7 +595,7 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
$scope.isOpen = SettingsService.settings.viewMode == 'expanded';
$scope.entryClicked = function(entry, event) {
$scope.navigationMode = 'click';
if (!event.ctrlKey && event.which != 2) {
if (!event || (!event.ctrlKey && event.which != 2)) {
if ($scope.current != entry || SettingsService.settings.viewMode == 'expanded') {
$scope.isOpen = true;
} else {
@@ -590,8 +605,10 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
$scope.mark(entry, true);
}
$scope.current = entry;
event.preventDefault();
event.stopPropagation();
if(event) {
event.preventDefault();
event.stopPropagation();
}
} else {
$scope.mark(entry, true);
}
@@ -731,6 +748,12 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
});
});
$scope.$on('previousEntry', function(event, args) {
openPreviousEntry();
});
$scope.$on('nextEntry', function(event, args) {
openNextEntry();
});
$scope.$on('markAll', function(event, args) {
$scope.markAll(args.olderThan);
});

View File

@@ -15,7 +15,11 @@
<a type="button" class="btn" ng-model="settingsService.settings.viewMode" btn-radio="'expanded'" title="Expanded view"><i class="icon-th-list"></i></a>
</div>
<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="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>
<div class="btn-group">
<a type="button" class="btn" ng-click="markAllAsRead()" title="${toolbar.mark_all_as_read}"><i class="icon-check"></i></a>