Added template loading through AJAX

This commit is contained in:
Marcin Kurczewski
2014-09-02 09:36:42 +02:00
parent 5573c49985
commit 978d22de67
9 changed files with 197 additions and 134 deletions

View File

@ -3,6 +3,7 @@ App.Presenters = App.Presenters || {};
App.Presenters.RegistrationPresenter = function(
jQuery,
util,
topNavigationPresenter,
messagePresenter,
api) {
@ -10,7 +11,12 @@ App.Presenters.RegistrationPresenter = function(
topNavigationPresenter.select('register');
var $el = jQuery('#content');
var template = _.template(jQuery('#registration-form-template').html());
var template;
util.loadTemplate('registration-form').then(function(html) {
template = _.template(html);
render();
});
var eventHandlers = {
@ -50,8 +56,6 @@ App.Presenters.RegistrationPresenter = function(
},
};
render();
function render() {
$el.html(template());
$el.find('form').submit(eventHandlers.registrationFormSubmit);