summaryrefslogtreecommitdiffstats
path: root/js/controller/ExploreController.js
blob: 4bc3a6d3e60f29512968456fa0e5e8d67340cdb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * ownCloud - News
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Bernhard Posselt <dev@bernhard-posselt.com>
 * @copyright Bernhard Posselt 2014
 */
app.controller('ExploreController', function (sites, $rootScope, FeedResource) {
    'use strict';

    this.sites = sites;

    this.feedExists = function (location) {
        return FeedResource.getByLocation(location) !== undefined;
    };

    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;
    };

});