diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-01-21 22:35:24 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-01-21 22:35:24 +0100 |
commit | bcb9ca95518126131a16fcde894fc8765e7ab010 (patch) | |
tree | bc1e0e8a5b99ffbf8cd4165c6872fd4468f547bd /js/controller/ExploreController.js | |
parent | 59daa89e4c82860d6b16b4e4bebab1eb8c302153 (diff) |
more explore
Diffstat (limited to 'js/controller/ExploreController.js')
-rw-r--r-- | js/controller/ExploreController.js | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/js/controller/ExploreController.js b/js/controller/ExploreController.js index 4bc3a6d3e..16d263ed3 100644 --- a/js/controller/ExploreController.js +++ b/js/controller/ExploreController.js @@ -8,22 +8,33 @@ * @copyright Bernhard Posselt 2014 */ app.controller('ExploreController', function (sites, $rootScope, FeedResource) { - 'use strict'; + 'use strict'; - this.sites = sites; + this.sites = sites; + // join all sites + this.feeds = Object.keys(sites).map(function (key) { + return [key, sites[key]]; + }).reduce(function (xs, x) { + var category = x[0]; + var feedList = x[1]; + feedList.forEach(function (feed) { + feed.category = category; + }); + return xs.concat(feedList); + }, []); - this.feedExists = function (location) { - return FeedResource.getByLocation(location) !== undefined; - }; + this.feedExists = function (location) { + return FeedResource.getByLocation(location) !== undefined; + }; - this.subscribeTo = function (location) { - $rootScope.$broadcast('addFeed', location); - }; + this.subscribeTo = function (location) { + $rootScope.$broadcast('addFeed', location); + }; - this.isCategoryShown = function (data) { - return data.filter(function (element) { - return FeedResource.getByLocation(element.feed) === undefined; - }).length > 0; - }; + this.isCategoryShown = function (data) { + return data.filter(function (element) { + return FeedResource.getByLocation(element.feed) === undefined; + }).length > 0; + }; });
\ No newline at end of file |