]> git.openstreetmap.org Git - rails.git/commitdiff
Move some javascript from the layout to application.js
authorTom Hughes <tom@compton.nu>
Tue, 28 Aug 2012 18:47:20 +0000 (19:47 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 28 Aug 2012 18:47:20 +0000 (19:47 +0100)
app/assets/javascripts/application.js
app/views/layouts/site.html.erb

index e40465f06e0d814607ffaeec433553a5b6327635..e02949f5867f8624bb8d68e63447dc5c6afc45b7 100644 (file)
@@ -254,3 +254,20 @@ $(document).ready(function () {
   $(".richtext_doedit").click(editRichtext);
   $(".richtext_dopreview").click(previewRichtext);
 });
   $(".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();
+});
index 0bff666565ad8126f0b0c9726ff1e214edaf6c3a..5a93608759491672941a9079df042a0cbf78d3ab 100644 (file)
       </div>
     </div>
 
       </div>
     </div>
 
-    <script type="text/javascript">
-    $(document).ready(function () {
-      var auth_token = $("meta[name=csrf-token]").attr("content");
-      $("form input[name=authenticity_token]").val(auth_token);
-
-      $("textarea").autoGrow();
-    });
-    </script>
-
     <% if defined?(PIWIK_LOCATION) and defined?(PIWIK_SITE) -%>
     <%= render :partial => "layouts/piwik" %>
     <% end -%>
     <% if defined?(PIWIK_LOCATION) and defined?(PIWIK_SITE) -%>
     <%= render :partial => "layouts/piwik" %>
     <% end -%>