summaryrefslogtreecommitdiffstats
path: root/js/controller/ExploreController.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controller/ExploreController.js')
-rw-r--r--js/controller/ExploreController.js22
1 files changed, 20 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();
+});