Merge pull request #67 from Sixfifty/patch-1

Fixed locale for AJAX requests on addWidget.
This commit is contained in:
Michael Parkhill 2013-08-19 20:16:50 -07:00
commit fb655f3862
2 changed files with 8 additions and 4 deletions

View File

@ -99,7 +99,6 @@ class WidgetController extends Controller {
if (class_exists('Translatable') && Member::currentUserID()) {
// set current locale based on logged in user's locale
$locale = Member::currentUser()->Locale;
Translatable::set_current_locale($locale);
i18n::set_locale($locale);
}
if(class_exists($className) && is_subclass_of($className, 'Widget')) {

View File

@ -103,10 +103,15 @@
}
}
var parentRef=$(this);
var parentRef=$(this),
locale = $(this).closest('form').find('input[name=Locale]').val();
$.ajax({
'url': 'WidgetController/EditableSegment/' + className,
'success' : function(response) {parentRef.insertWidgetEditor(response)}
'success' : function(response) {parentRef.insertWidgetEditor(response)},
'data' : {
'locale' : locale ,
},
});
},
@ -177,4 +182,4 @@
}
});
})
})(jQuery);
})(jQuery);