mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 15:05:54 +00:00
Merge pull request #67 from Sixfifty/patch-1
Fixed locale for AJAX requests on addWidget.
This commit is contained in:
commit
fb655f3862
@ -99,7 +99,6 @@ class WidgetController extends Controller {
|
|||||||
if (class_exists('Translatable') && Member::currentUserID()) {
|
if (class_exists('Translatable') && Member::currentUserID()) {
|
||||||
// set current locale based on logged in user's locale
|
// set current locale based on logged in user's locale
|
||||||
$locale = Member::currentUser()->Locale;
|
$locale = Member::currentUser()->Locale;
|
||||||
Translatable::set_current_locale($locale);
|
|
||||||
i18n::set_locale($locale);
|
i18n::set_locale($locale);
|
||||||
}
|
}
|
||||||
if(class_exists($className) && is_subclass_of($className, 'Widget')) {
|
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({
|
$.ajax({
|
||||||
'url': 'WidgetController/EditableSegment/' + className,
|
'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…
x
Reference in New Issue
Block a user