From 676b8dd18742875ae07827792ed88d2b5bb3afb7 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 19 Nov 2014 15:54:32 +0100 Subject: first stab at recommended sites --- js/build/app.js | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'js/build/app.js') diff --git a/js/build/app.js b/js/build/app.js index 9e4e3c52f..0c8d62195 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -13,7 +13,8 @@ app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvi FOLDER: 1, STARRED: 2, SUBSCRIPTIONS: 3, - SHARED: 4 + SHARED: 4, + EXPLORE: 5 }; // constants @@ -95,6 +96,15 @@ app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvi templateUrl: 'content.html', resolve: getResolve(feedType.FOLDER), type: feedType.FOLDER + }).when('/explore', { + controller: 'ExploreController as Explore', + templateUrl: 'explore.html', + resolve: { + sites: /* @ngInject */ ["$http", "BASE_URL", function ($http, BASE_URL) { + return $http.get(BASE_URL + '/explore'); + }] + }, + type: feedType.EXPLORE }).when('/shortcuts', { templateUrl: 'shortcuts.html', type: -1 @@ -145,6 +155,10 @@ app.run(["$rootScope", "$location", "$http", "$q", "$interval", "Loading", "Item url = '/items/starred'; break; + case FEED_TYPE.EXPLORE: + url = '/explore'; + break; + default: url = '/items'; } @@ -230,10 +244,14 @@ app.controller('AppController', }]); app.controller('ContentController', -["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", "FEED_TYPE", function (Publisher, FeedResource, ItemResource, SettingsResource, data, - $route, $routeParams, FEED_TYPE) { +["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", "FEED_TYPE", "$location", "FolderResource", function (Publisher, FeedResource, ItemResource, SettingsResource, data, + $route, $routeParams, FEED_TYPE, $location, FolderResource) { 'use strict'; + if (FeedResource.size() === 0 && FolderResource.size() === 0) { + $location.path('/explore'); + } + // dont cache items across multiple route changes ItemResource.clear(); @@ -369,6 +387,12 @@ app.controller('ContentController', $route.reload(); }; +}]); +app.controller('ExploreController', ["sites", function (sites) { + 'use strict'; + + this.sites = sites.data; + }]); app.controller('NavigationController', ["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", "Publisher", "$rootScope", "$location", "$q", function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, @@ -475,6 +499,11 @@ app.controller('NavigationController', $route.current.$$route.type === FEED_TYPE.STARRED; }; + this.isExploreActive = function () { + return $route.current && + $route.current.$$route.type === FEED_TYPE.EXPLORE; + }; + this.isFolderActive = function (folderId) { return $route.current && $route.current.$$route.type === FEED_TYPE.FOLDER && -- cgit v1.2.3