diff --git a/css/core.css b/css/core.css index 8b3f416..56bdd0b 100644 --- a/css/core.css +++ b/css/core.css @@ -250,6 +250,15 @@ button { background-color: #ff8175; } +.feedItemOptions { + padding: 6px; + font-size: 13px; +} + +.feedItemOptions i { + font-size: 16px; +} + .title-slider { display: inline-block; animation: bounce-text 30s linear infinite; diff --git a/js/controllers.js b/js/controllers.js index e8c8928..e7b3425 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -28,7 +28,7 @@ function FeedListCtrl($scope, feeds, pageSwitcher, $location) { pageSwitcher.change('feeds'); } -function FeedCtrl($scope, $routeParams, $location, feeds, pageSwitcher) { +function FeedCtrl($scope, $routeParams, $location, feeds, pageSwitcher, feedItems) { $scope.nrQueueItemsOptions = [1, 2, 3, 4, 5]; $scope.feed = {}; // show info at top and items underneath @@ -49,29 +49,79 @@ function FeedCtrl($scope, $routeParams, $location, feeds, pageSwitcher) { } }; + $scope.showItemOptions = function(id) { + angular.forEach($scope.feed.items, function(value, key) { + if (value.id == id) { + $scope.feed.items[key].showOptions = !$scope.feed.items[key].showOptions; + } else { + $scope.feed.items[key].showOptions = false; + } + }); + }; + + $scope.addToQueue = function(id) { + feedItems.addToQueue(id); + }; + pageSwitcher.setBack('feeds'); } function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, downloader, queueList, pageChanger) { $scope.queue = queueList.getQueueList(); + $scope.$on('queueListRefresh', function(event) { + $rootScope.$apply(queueList.rebuildList()); + }); + $scope.playItem = function(id) { feedItems.get(id, function(feedItem) { $rootScope.$broadcast('playItem', feedItem); }); }; + $scope.showItemOptions = function(id) { + angular.forEach($scope.queue, function(value, key) { + if (value.id == id) { + $scope.queue[key].showOptions = !$scope.queue[key].showOptions; + } else { + $scope.queue[key].showOptions = false; + } + }); + }; + + $scope.downloadFile = function(id) { + feedItems.get(id, function(feedItem) { + downloader.downloadFiles([feedItem]); + }); + }; + + $scope.removeFromQueue = function(feedItemId) { + feedItems.unQueue(feedItemId); + }; + $scope.downloadItems = function(updateStatus) { feeds.downloadAllItems(feedItems, function(feedItem, feed) { if (feedItem) { $scope.queue.push(feedItem); - $scope.$apply(); } updateStatus(feed); + $scope.$broadcast('queueListRefresh'); }); }; + $scope.reDownloadFile = function(id) { + feedItems.get(id, function(feedItem) { + feedItem.audio = null; + downloader.downloadFiles([feedItem]); + }); + }; + + //TODO: extract this to somewhere + $scope.goToFeed = function(feedId) { + pageChanger.goToFeed(feedId); + }; + pageSwitcher.change('queue'); } diff --git a/partials/feed.html b/partials/feed.html index 6113eb3..9a0bec1 100644 --- a/partials/feed.html +++ b/partials/feed.html @@ -1,29 +1,32 @@ -