From d9054cfe29efeb615237a143ca620c53af37288f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 28 Aug 2012 19:47:20 +0100 Subject: [PATCH] Move some javascript from the layout to application.js --- app/assets/javascripts/application.js | 17 +++++++++++++++++ app/views/layouts/site.html.erb | 9 --------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e40465f06..e02949f58 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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(); +}); diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index 0bff66656..5a9360875 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -143,15 +143,6 @@ - - <% if defined?(PIWIK_LOCATION) and defined?(PIWIK_SITE) -%> <%= render :partial => "layouts/piwik" %> <% end -%> -- 2.39.5