From 6097f4c122d027da74c9c270109b616338bbcdf4 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Sun, 20 Mar 2022 13:07:36 +0530 Subject: [PATCH] fix: Update survey locale based on the account (#4207) --- .codeclimate.yml | 3 + .eslintrc.js | 4 +- app/javascript/packs/survey.js | 2 + app/javascript/shared/components/Branding.vue | 18 ++++-- app/javascript/survey/i18n/index.js | 64 +++++++++++++++++++ app/javascript/survey/store/index.js | 11 ++++ app/javascript/survey/views/Response.vue | 4 ++ .../api/v1/models/_csat_survey.json.jbuilder | 1 + 8 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 app/javascript/survey/store/index.js diff --git a/.codeclimate.yml b/.codeclimate.yml index c9910f9ed..916b98510 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -50,3 +50,6 @@ exclude_patterns: - 'app/javascript/dashboard/routes/dashboard/settings/automation/constants.js' - 'app/javascript/dashboard/components/widgets/FilterInput/FilterOperatorTypes.js' - 'app/javascript/dashboard/routes/dashboard/settings/reports/constants.js' + - 'app/javascript/dashboard/i18n/index.js' + - 'app/javascript/widget/i18n/index.js' + - 'app/javascript/survey/i18n/index.js' diff --git a/.eslintrc.js b/.eslintrc.js index a52594492..f30e21e03 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,8 +29,8 @@ module.exports = { 'vue/html-self-closing': 'off', "vue/no-v-html": 'off', 'vue/singleline-html-element-content-newline': 'off', - 'import/extensions': ['off'] - + 'import/extensions': ['off'], + 'no-console': 'error' }, settings: { 'import/resolver': { diff --git a/app/javascript/packs/survey.js b/app/javascript/packs/survey.js index 3c65f8b82..30bbcf47a 100644 --- a/app/javascript/packs/survey.js +++ b/app/javascript/packs/survey.js @@ -3,6 +3,7 @@ import Vuelidate from 'vuelidate'; import VueI18n from 'vue-i18n'; import App from '../survey/App.vue'; import i18n from '../survey/i18n'; +import store from '../survey/store'; Vue.use(VueI18n); Vue.use(Vuelidate); @@ -20,6 +21,7 @@ Vue.config.productionTip = false; window.onload = () => { window.WOOT_SURVEY = new Vue({ i18n: i18nConfig, + store, render: h => h(App), }).$mount('#app'); }; diff --git a/app/javascript/shared/components/Branding.vue b/app/javascript/shared/components/Branding.vue index faa212e9e..0b075d04d 100644 --- a/app/javascript/shared/components/Branding.vue +++ b/app/javascript/shared/components/Branding.vue @@ -21,7 +21,6 @@ diff --git a/app/views/public/api/v1/models/_csat_survey.json.jbuilder b/app/views/public/api/v1/models/_csat_survey.json.jbuilder index 853c41cf5..134cb1af1 100644 --- a/app/views/public/api/v1/models/_csat_survey.json.jbuilder +++ b/app/views/public/api/v1/models/_csat_survey.json.jbuilder @@ -2,5 +2,6 @@ json.id resource.id json.csat_survey_response resource.csat_survey_response json.inbox_avatar_url resource.inbox.avatar_url json.inbox_name resource.inbox.name +json.locale resource.account.locale json.conversation_id resource.conversation_id json.created_at resource.created_at