diff options
Diffstat (limited to 'js/controller')
-rw-r--r-- | js/controller/ExploreController.js | 22 | ||||
-rw-r--r-- | js/controller/NavigationController.js | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/js/controller/ExploreController.js b/js/controller/ExploreController.js index 16d263ed3..61ecb4385 100644 --- a/js/controller/ExploreController.js +++ b/js/controller/ExploreController.js @@ -7,7 +7,8 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -app.controller('ExploreController', function (sites, $rootScope, FeedResource) { +app.controller('ExploreController', +function (sites, $rootScope, FeedResource, SettingsResource, $location) { 'use strict'; this.sites = sites; @@ -37,4 +38,21 @@ app.controller('ExploreController', function (sites, $rootScope, FeedResource) { }).length > 0; }; -});
\ No newline at end of file + this.getSupportedLanguageCodes = function () { + return SettingsResource.getSupportedLanguageCodes(); + }; + + this.getCurrentLanguageCode = function () { + var language = $location.search().lang; + if (!language) { + language = SettingsResource.get('language'); + } + return language; + }; + + this.showLanguage = function (languageCode) { + $location.url('/explore/?lang=' + languageCode); + }; + + this.selectedLanguageCode = this.getCurrentLanguageCode(); +}); diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js index 800978b16..160f77bac 100644 --- a/js/controller/NavigationController.js +++ b/js/controller/NavigationController.js @@ -25,6 +25,10 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, return parseInt($route.current.params.id, 10); }; + this.getLanguageCode = function () { + return SettingsResource.get('language'); + }; + this.getFeeds = function () { return FeedResource.getAll(); }; |