From: Tom Hughes Date: Tue, 28 Aug 2012 18:47:20 +0000 (+0100) Subject: Move some javascript from the layout to application.js X-Git-Tag: live~5388 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d9054cfe29efeb615237a143ca620c53af37288f Move some javascript from the layout to application.js --- 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 -%>