summaryrefslogtreecommitdiffstats
path: root/js/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-01-23 17:08:45 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2016-01-23 17:08:45 +0100
commite3ae4ea0bebc05e7ef16326501a9654ca9095310 (patch)
treedb2d945082ea76a00b472f9ab5b7077e38c22804 /js/controller
parent120a94582f62da9cf3ed32ad611ccdd226e5a751 (diff)
add german feeds and allow to change the language
Diffstat (limited to 'js/controller')
-rw-r--r--js/controller/ExploreController.js22
-rw-r--r--js/controller/NavigationController.js4
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();
};