mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Fixed locale for AJAX requests on addWidget.
Currently locale is ignored with AJAX add requests, this patch sends the form locale with the request.
This commit is contained in:
parent
6f534f5943
commit
1013e216c2
@ -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')) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user