Permalink
Browse files

Use full URL for javascript so works in admin pages.

  • Loading branch information...
1 parent ec3c2d2 commit be47b35c8f5fbc1b4e495e5e1aa6bb3b42ef392c francis committed Aug 24, 2009
Showing with 6 additions and 4 deletions.
  1. +1 −4 app/views/layouts/admin.rhtml
  2. +5 −0 config/environment.rb
View
5 app/views/layouts/admin.rhtml
@@ -3,10 +3,7 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
<title>WhatDoTheyKnow admin<%= @title ? ":" : "" %> <%=@title%></title>
- <%
- # Have to do explicit tag for stylesheet, to get absolute path on main server
- %>
- <%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => admin_public_url(stylesheet_path('admin')) }) %>
+ <%= stylesheet_link_tag 'admin', :title => "Main", :rel => "stylesheet" %>
</head>
<body>
View
5 config/environment.rb
@@ -97,6 +97,11 @@ def tag(name, options = nil, open = false, escape = true)
# Domain for URLs (so can work for scripts, not just web pages)
ActionController::UrlWriter.default_url_options[:host] = MySociety::Config.get("DOMAIN", 'localhost:3000')
+# So that javascript assets use full URL, so proxied admin URLs read javascript OK
+if (MySociety::Config.get("DOMAIN", "") != "")
+ ActionController::Base.asset_host = MySociety::Config.get("DOMAIN", 'localhost:3000')
+end
+
# Monkeypatch! Method to remove individual error messages from an ActiveRecord.
module ActiveRecord
class Errors

0 comments on commit be47b35

Please sign in to comment.