Skip to content

Instantly share code, notes, and snippets.

@juliensnz
Created April 14, 2016 15:56
Show Gist options
  • Save juliensnz/0179dfb683bae0a5180927f3f00ed901 to your computer and use it in GitHub Desktop.
Save juliensnz/0179dfb683bae0a5180927f3f00ed901 to your computer and use it in GitHub Desktop.
select2 patch
diff --git a/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/multi-select-field.js b/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/multi-select-field.js
index 189699d..1c37821 100644
--- a/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/multi-select-field.js
+++ b/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/multi-select-field.js
@@ -16,9 +16,10 @@ define(
'routing',
'pim/attribute-option/create',
'pim/security-context',
- 'pim/initselect2'
+ 'pim/initselect2',
+ 'pim/user-context'
],
- function ($, Field, _, fieldTemplate, Routing, createOption, SecurityContext, initSelect2) {
+ function ($, Field, _, fieldTemplate, Routing, createOption, SecurityContext, initSelect2, UserContext) {
return Field.extend({
fieldTemplate: _.template(fieldTemplate),
choicePromise: null,
@@ -75,7 +76,12 @@ define(
url: choiceUrl,
cache: true,
data: function (term) {
- return {search: term};
+ return {
+ search: term,
+ options: {
+ 'locale': UserContext.get('catalogLocale')
+ }
+ };
},
results: function (data) {
return data;
diff --git a/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/simple-select-field.js b/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/simple-select-field.js
index b506247..12e6d0a 100644
--- a/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/simple-select-field.js
+++ b/src/Pim/Bundle/EnrichBundle/Resources/public/js/product/field/simple-select-field.js
@@ -16,9 +16,10 @@ define(
'routing',
'pim/attribute-option/create',
'pim/security-context',
- 'pim/initselect2'
+ 'pim/initselect2',
+ 'pim/user-context'
],
- function ($, Field, _, fieldTemplate, Routing, createOption, SecurityContext, initSelect2) {
+ function ($, Field, _, fieldTemplate, Routing, createOption, SecurityContext, initSelect2, UserContext) {
return Field.extend({
fieldTemplate: _.template(fieldTemplate),
choicePromise: null,
@@ -74,7 +75,12 @@ define(
url: choiceUrl,
cache: true,
data: function (term) {
- return {search: term};
+ return {
+ search: term,
+ options: {
+ 'locale': UserContext.get('catalogLocale')
+ }
+ };
},
results: function (data) {
return data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment