From 0ed46c3bae81434ed82b11b70eb62e7d3a054c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 8 Apr 2015 11:54:38 -0400 Subject: [PATCH] closes #2963, closes #2957 --- public/src/admin/general/languages.js | 8 ++++++-- src/controllers/admin.js | 6 ++++++ src/views/admin/general/languages.tpl | 8 +++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/public/src/admin/general/languages.js b/public/src/admin/general/languages.js index 8720f96df2..24d6a418c9 100644 --- a/public/src/admin/general/languages.js +++ b/public/src/admin/general/languages.js @@ -2,7 +2,11 @@ /*global define*/ define('admin/general/languages', ['admin/settings'], function(Settings) { - $(function() { + var Languages = {} + + Languages.init = function() { Settings.prepare(); - }); + }; + + return Languages; }); diff --git a/src/controllers/admin.js b/src/controllers/admin.js index 91f8310a94..8b1e3f7d35 100644 --- a/src/controllers/admin.js +++ b/src/controllers/admin.js @@ -250,6 +250,12 @@ adminController.plugins.get = function(req, res, next) { adminController.languages.get = function(req, res, next) { languages.list(function(err, languages) { + if (err) { + return next(err); + } + languages.forEach(function(language) { + language.selected = language.code === meta.config.defaultLang; + }); res.render('admin/general/languages', { languages: languages }); diff --git a/src/views/admin/general/languages.tpl b/src/views/admin/general/languages.tpl index b2365e91a3..6075647d77 100644 --- a/src/views/admin/general/languages.tpl +++ b/src/views/admin/general/languages.tpl @@ -14,13 +14,13 @@ - + @@ -35,6 +35,4 @@ - +