the locale was missing when saving an editable element by the inline editor

This commit is contained in:
Didier Lafforgue 2012-02-10 01:42:06 +01:00
parent 62eaeb10f5
commit 1332185d85
5 changed files with 11 additions and 5 deletions

View File

@ -113,6 +113,8 @@ class Locomotive.Views.InlinEditor.ToolbarView extends Backbone.View
picker.toggle()
window.content_locale = selected[1]
_window.location.href = '/' + @model.get('localized_fullpaths')[selected[1]] + '/_edit'
get_locale_attributes: (context) ->

View File

@ -12,7 +12,7 @@ module Locomotive
before_filter :validate_site_membership, :only => [:show_toolbar]
before_filter :set_ui_locale, :only => :show_toolbar
before_filter :set_toolbar_locale, :only => :show_toolbar
before_filter :set_locale, :only => [:show, :edit]
@ -31,9 +31,9 @@ module Locomotive
protected
def set_ui_locale
def set_toolbar_locale
::I18n.locale = current_locomotive_account.locale rescue Locomotive.config.default_locale
::Mongoid::Fields::I18n.locale = params[:locale] || current_site.default_locale
::Mongoid::Fields::I18n.locale = session[:content_locale] || current_site.default_locale
end
def set_locale

View File

@ -16,7 +16,8 @@
%script{ :type => 'text/javascript' }
:plain
window.locale = '#{I18n.locale}';
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});

View File

@ -12,7 +12,8 @@
%script{ :type => 'text/javascript' }
:plain
window.locale = '#{I18n.locale}';
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});

View File

@ -48,6 +48,8 @@
var formData = new FormData();
formData.append('xhr', true); // fix a bug with POW which happens to not like empty form
if (window.content_locale)
formData.append('content_locale', window.content_locale);
var _buildParams = function(prefix, obj, fn) { // code grabbed from jquery
if (jQuery.isArray(obj)) {