Load the locomotive mount path earlier in the JS to make it available for backbone models. Fixes #336

This commit is contained in:
Mario Visic 2012-04-06 15:54:54 +08:00
parent 22f34a5a60
commit 6677689902
2 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@
#= require_tree ./views
window.Locomotive =
mounted_on: '/locomotive' # default path
mounted_on: window.Locomotive.mounted_on
Models: {}
Collections: {}
Views: {}

View File

@ -7,6 +7,10 @@
%meta{ :name => 'key-param', :content => Rails.application.config.session_options[:key] }
%meta{ :name => 'key-token', :content => cookies[key] }
%script{ :type => 'text/javascript' }
:plain
window.Locomotive = { mounted_on: '#{Locomotive.mounted_on}' };
= stylesheet_link_tag 'locomotive', :media => 'screen'
= javascript_include_tag 'locomotive'
@ -15,7 +19,6 @@
window.locale = '#{I18n.locale}';
window.content_locale = '#{::Mongoid::Fields::I18n.locale}';
Locomotive.mounted_on = '#{Locomotive.mounted_on}';
Locomotive.current_site = new Locomotive.Models.Site(#{current_site.to_json});
Locomotive.current_account = new Locomotive.Models.Account(#{current_locomotive_account.to_json});