Clean up duplicated code in setup.js

(imported from commit 86566f194497b618dff0be6ea2bc829204d03366)
This commit is contained in:
Keegan McAllister 2012-10-26 16:04:01 -04:00
parent 3e86da67f9
commit faa7565a75
1 changed files with 5 additions and 4 deletions

View File

@ -13,10 +13,11 @@ $(function () {
}
// Compile Handlebars templates.
templates.message = Handlebars.compile($("#template_message").html());
templates.subscription = Handlebars.compile($("#template_subscription").html());
templates.userinfo_popover_title = Handlebars.compile($("#template_userinfo_popover_title").html());
templates.userinfo_popover_content = Handlebars.compile($("#template_userinfo_popover_content").html());
$.each(['message', 'subscription', 'userinfo_popover_title', 'userinfo_popover_content'],
function (index, name) {
templates[name] = Handlebars.compile($('#template_'+name).html());
}
);
// This requires that we used Django's {% csrf_token %} somewhere on the page.
var csrftoken = $('input[name="csrfmiddlewaretoken"]').attr('value');