From 68570f9603cad5e9ea58db2d3e26d39c90b050cd Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Fri, 27 Jan 2012 20:07:23 -0800 Subject: [PATCH] Pass JavaScript run through the application controller for localization --- app/controllers/javascripts_controller.rb | 2 ++ app/{assets => views}/javascripts/main.js.erb | 0 app/views/layouts/application.html.haml | 2 +- config/routes.rb | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 app/controllers/javascripts_controller.rb rename app/{assets => views}/javascripts/main.js.erb (100%) diff --git a/app/controllers/javascripts_controller.rb b/app/controllers/javascripts_controller.rb new file mode 100644 index 0000000..cd439bd --- /dev/null +++ b/app/controllers/javascripts_controller.rb @@ -0,0 +1,2 @@ +class JavascriptsController < ApplicationController +end diff --git a/app/assets/javascripts/main.js.erb b/app/views/javascripts/main.js.erb similarity index 100% rename from app/assets/javascripts/main.js.erb rename to app/views/javascripts/main.js.erb diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index d282f43..bff4ae7 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -14,7 +14,7 @@ = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-twipsy.min.js" = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-alerts.min.js" = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-modal.min.js" - = javascript_include_tag "main" + = javascript_include_tag javascript_path %script{:type => "text/javascript"} var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-20825280-2"]),_gaq.push(["_setDomainName",".adoptahydrant.org"]),_gaq.push(["_trackPageview"]),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(); = stylesheet_link_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css" diff --git a/config/routes.rb b/config/routes.rb index 351b7de..2922f1a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,7 @@ AdoptAThing::Application.routes.draw do get 'address' => 'addresses#show', :as => 'address' get 'info_window' => 'info_window#index', :as => 'info_window' get 'sitemap' => 'sitemaps#index', :as => 'sitemap' + get 'javascripts/main(.:format)' => 'javascripts#main', :as => 'javascript' scope "sidebar", :controller => :sidebar do get :search, :as => 'search'