From 7adf411f9d57f535f811974adb274a1398b5e2db Mon Sep 17 00:00:00 2001 From: Mile Divovic Date: Mon, 25 Nov 2024 16:29:23 -0800 Subject: [PATCH] Fix framework inLanguage not applying to competencies that are created in that framework --- src/App.vue | 2 ++ src/mixins/common.js | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 5a0286dd4..972ccb704 100644 --- a/src/App.vue +++ b/src/App.vue @@ -504,6 +504,7 @@ export default { f.copyFrom(wut); } me.$store.commit('editor/framework', f); + me.setDefaultLanguage(); me.spitEvent("frameworkChanged", f.shortId()); } } @@ -519,6 +520,7 @@ export default { f.copyFrom(wut); } me.$store.commit('editor/framework', f); + me.setDefaultLanguage(); me.spitEvent("frameworkChanged", f.shortId()); } } diff --git a/src/mixins/common.js b/src/mixins/common.js index 166e1abd6..be770dca3 100644 --- a/src/mixins/common.js +++ b/src/mixins/common.js @@ -190,13 +190,17 @@ export default { } }, setDefaultLanguage: function() { + let framework = this.framework; + if (!framework) { + framework = this.$store.getters['editor/framework']; + } var defaultLanguage; - if (this.framework && this.framework["ceasn:inLanguage"]) { - defaultLanguage = EcArray.isArray(this.framework["ceasn:inLanguage"]) ? this.framework["ceasn:inLanguage"][0] : this.framework["ceasn:inLanguage"]; - } else if (this.framework && this.framework["schema:inLanguage"]) { - defaultLanguage = EcArray.isArray(this.framework["schema:inLanguage"]) ? this.framework["schema:inLanguage"][0] : this.framework["schema:inLanguage"]; - } else if (this.framework && this.framework["dcterms:language"]) { - defaultLanguage = EcArray.isArray(this.framework["dcterms:language"]) ? this.framework["dcterms:language"][0] : this.framework["dcterms:language"]; + if (framework && framework["ceasn:inLanguage"]) { + defaultLanguage = EcArray.isArray(framework["ceasn:inLanguage"]) ? framework["ceasn:inLanguage"][0] : framework["ceasn:inLanguage"]; + } else if (framework && framework["schema:inLanguage"]) { + defaultLanguage = EcArray.isArray(framework["schema:inLanguage"]) ? framework["schema:inLanguage"][0] : framework["schema:inLanguage"]; + } else if (framework && framework["dcterms:language"]) { + defaultLanguage = EcArray.isArray(framework["dcterms:language"]) ? framework["dcterms:language"][0] : framework["dcterms:language"]; } else if (navigator.language || navigator.userLanguage) { defaultLanguage = navigator.language || navigator.userLanguage; } else {