Build an asset manifest for iD

This commit is contained in:
Tom Hughes 2013-08-16 21:02:25 +01:00
parent d23f262543
commit 2afb1242cc
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,11 @@
module AssetHelper
def assets(directory)
assets = {}
Rails.application.assets.index.each_logical_path("#{directory}/*") do |path|
assets[path.sub(/^#{directory}\//, "")] = asset_path(path)
end
assets
end
end

View file

@ -21,6 +21,7 @@
var id = iD()
.embed(true)
.assetPath("/assets/iD/") <%# Can't use asset_path('iD/') in production. %>
.assetMap(<%= assets("iD").to_json.html_safe %>)
.locale("<%= locale %>", "<%= asset_path("iD/locales/#{locale}.json") %>")
.preauth({
<% token = @user.access_token(ID_KEY) %>