diff --git a/app/email_confirmation.html b/app/email_confirmation.html index 9d3a54a..65a914e 100644 --- a/app/email_confirmation.html +++ b/app/email_confirmation.html @@ -30,8 +30,9 @@ - + + diff --git a/app/js/authentication_controller.js b/app/js/authentication_controller.js index 4b1ebf5..e00e414 100644 --- a/app/js/authentication_controller.js +++ b/app/js/authentication_controller.js @@ -44,8 +44,5 @@ }; exports.AuthenticationController = AuthenticationController; - - document.addEventListener('initialize', function() { - AuthenticationController.init(); - }); + AuthenticationController.init(); })(window); diff --git a/app/js/email_confirmation_controller.js b/app/js/email_confirmation_controller.js index 00b0328..1448efa 100644 --- a/app/js/email_confirmation_controller.js +++ b/app/js/email_confirmation_controller.js @@ -64,8 +64,5 @@ }; exports.EmailConfirmationController = EmailConfirmationController; - - document.addEventListener('initialize', function() { - EmailConfirmationController.init(); - }); + EmailConfirmationController.init(); })(window); diff --git a/app/js/error_controller.js b/app/js/error_controller.js index ee05eed..4beee5f 100644 --- a/app/js/error_controller.js +++ b/app/js/error_controller.js @@ -32,8 +32,5 @@ }; exports.ErrorController = ErrorController; - - document.addEventListener('initialize', function() { - ErrorController.init(); - }); + ErrorController.init(); })(window); diff --git a/app/js/helper_profile_controller.js b/app/js/helper_profile_controller.js index 1ed0490..e429696 100644 --- a/app/js/helper_profile_controller.js +++ b/app/js/helper_profile_controller.js @@ -66,8 +66,5 @@ }; exports.HelperProfileController = HelperProfileController; - - document.addEventListener('initialize', function() { - HelperProfileController.init(); - }); + HelperProfileController.init(); })(window); diff --git a/app/js/home_controller.js b/app/js/home_controller.js index 66a8a5b..43a0d20 100644 --- a/app/js/home_controller.js +++ b/app/js/home_controller.js @@ -32,8 +32,5 @@ }; exports.HomeController = HomeController; - - document.addEventListener('initialize', function() { - HomeController.init(); - }); + HomeController.init(); })(window); diff --git a/app/js/loader.js b/app/js/loader.js index be9c6ba..f2f6af7 100644 --- a/app/js/loader.js +++ b/app/js/loader.js @@ -1,23 +1,17 @@ 'use strict'; -/* global gettext, nunjucks */ +/* global nunjucksEnv */ (function(exports) { var Loader = { init: function() { - var env = new nunjucks.Environment(); - env.addGlobal('_', gettext); - var elems = document.querySelectorAll('[data-template]'); for (var i=0; i < elems.length; i++) { var elem = elems[i]; - var html = nunjucks.render(elem.dataset.template); + var html = nunjucksEnv.render(elem.dataset.template); elem.innerHTML = html; } - - var event = new Event('initialize'); - document.dispatchEvent(event); } }; diff --git a/app/js/loading_indicator.js b/app/js/loading_indicator.js index e2b7229..40e4ce5 100644 --- a/app/js/loading_indicator.js +++ b/app/js/loading_indicator.js @@ -41,8 +41,5 @@ }; exports.LoadingIndicator = LoadingIndicator; - - document.addEventListener('initialize', function() { - LoadingIndicator.init(); - }); + LoadingIndicator.init(); })(window); diff --git a/app/js/nunjucks_env.js b/app/js/nunjucks_env.js index 539bea2..fb15f65 100644 --- a/app/js/nunjucks_env.js +++ b/app/js/nunjucks_env.js @@ -1,8 +1,12 @@ 'use strict'; -/* global nunjucks */ +/* global gettext, nunjucks */ -(function() { +(function(exports) { var loader = new nunjucks.WebLoader('/views'); - window.nunjucksEnv = new nunjucks.Environment(loader, {autoescape: true}); -})(); + + var nunjucksEnv = new nunjucks.Environment(loader, {autoescape: true}); + nunjucksEnv.addGlobal('_', gettext); + + exports.nunjucksEnv = nunjucksEnv; +})(window); diff --git a/app/js/old_versions_controller.js b/app/js/old_versions_controller.js index 65c2e29..d43cbcb 100644 --- a/app/js/old_versions_controller.js +++ b/app/js/old_versions_controller.js @@ -13,8 +13,5 @@ }; exports.OldVersionsController = OldVersionsController; - - document.addEventListener('initialize', function() { - OldVersionsController.init(); - }); + OldVersionsController.init(); })(window); diff --git a/app/js/password_reset_controller.js b/app/js/password_reset_controller.js index 5762ca3..f2cece6 100644 --- a/app/js/password_reset_controller.js +++ b/app/js/password_reset_controller.js @@ -34,9 +34,5 @@ }; exports.PasswordResetController = PasswordResetController; - - document.addEventListener('initialize', function() { - PasswordResetController.init(); - }); - + PasswordResetController.init(); })(window); diff --git a/app/js/profile_controller.js b/app/js/profile_controller.js index 34a4457..77e4427 100644 --- a/app/js/profile_controller.js +++ b/app/js/profile_controller.js @@ -105,9 +105,5 @@ }; exports.ProfileController = ProfileController; - - document.addEventListener('initialize', function() { - ProfileController.init(); - }); - + ProfileController.init(); })(window); diff --git a/app/js/question_controller.js b/app/js/question_controller.js index ac4f36c..cb136b1 100644 --- a/app/js/question_controller.js +++ b/app/js/question_controller.js @@ -558,9 +558,5 @@ } }; exports.QuestionController = QuestionController; - - document.addEventListener('initialize', function() { - QuestionController.init(); - }); - + QuestionController.init(); })(window); diff --git a/app/js/questions_controller.js b/app/js/questions_controller.js index 2312fe1..54dfabd 100644 --- a/app/js/questions_controller.js +++ b/app/js/questions_controller.js @@ -221,9 +221,5 @@ }; exports.QuestionsController = QuestionsController; - - document.addEventListener('initialize', function() { - QuestionsController.init(); - }); - + QuestionsController.init(); })(window); diff --git a/app/js/registration_controller.js b/app/js/registration_controller.js index 413f4c2..d28da8b 100644 --- a/app/js/registration_controller.js +++ b/app/js/registration_controller.js @@ -49,9 +49,5 @@ }; exports.RegisterationController = RegistrationController; - - document.addEventListener('initialize', function() { - RegistrationController.init(); - }); - + RegistrationController.init(); })(window); diff --git a/app/js/unsupported_locale_controller.js b/app/js/unsupported_locale_controller.js index 7904f0c..91a3cf3 100644 --- a/app/js/unsupported_locale_controller.js +++ b/app/js/unsupported_locale_controller.js @@ -20,8 +20,5 @@ }; exports.UnsupportedLocaleController = UnsupportedLocaleController; - - document.addEventListener('initialize', function() { - UnsupportedLocaleController.init(); - }); + UnsupportedLocaleController.init(); })(window); diff --git a/app/kb.html b/app/kb.html index ca68cb7..4d17d1d 100644 --- a/app/kb.html +++ b/app/kb.html @@ -25,8 +25,9 @@ - + + diff --git a/app/old_versions.html b/app/old_versions.html index 0f4f18e..15ee433 100644 --- a/app/old_versions.html +++ b/app/old_versions.html @@ -27,8 +27,9 @@ - + + diff --git a/app/unsupported_locale.html b/app/unsupported_locale.html index 7213a4b..3404f10 100644 --- a/app/unsupported_locale.html +++ b/app/unsupported_locale.html @@ -28,8 +28,9 @@ - + +