Move some javascript from the layout to application.js

This commit is contained in:
Tom Hughes 2012-08-28 19:47:20 +01:00
parent 96a4fb0805
commit d9054cfe29
2 changed files with 17 additions and 9 deletions

View file

@ -254,3 +254,20 @@ $(document).ready(function () {
$(".richtext_doedit").click(editRichtext);
$(".richtext_dopreview").click(previewRichtext);
});
/*
* Forms which have been cached by rails may have he wrong
* authenticity token, so patch up any forms with the correct
* token taken from the page header.
*/
$(document).ready(function () {
var auth_token = $("meta[name=csrf-token]").attr("content");
$("form input[name=authenticity_token]").val(auth_token);
});
/*
* Enable auto expansion for all text areas
*/
$(document).ready(function () {
$("textarea").autoGrow();
});