From b14567684d62d55a13edd4f026beb23973678d11 Mon Sep 17 00:00:00 2001 From: christian Date: Wed, 1 Nov 2023 23:50:02 -0500 Subject: [PATCH 1/2] Course: Fix filemanager from editor and saving intro - refs #21046 --- assets/vue/components/ctoolintro/Form.vue | 8 +++++--- assets/vue/mixins/UpdateMixin.js | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/vue/components/ctoolintro/Form.vue b/assets/vue/components/ctoolintro/Form.vue index 13b2eaa744..4a1b3aaa17 100644 --- a/assets/vue/components/ctoolintro/Form.vue +++ b/assets/vue/components/ctoolintro/Form.vue @@ -77,12 +77,14 @@ export default { }, methods: { browser(callback, value, meta) { - //const route = useRoute(); - let nodeId = this.$route.params["node"]; + let nodeId = this.$route.query.ctoolId; + if (!nodeId) { + nodeId = this.$route.params.courseTool; + } let folderParams = this.$route.query; let url = this.$router.resolve({ name: "DocumentForHtmlEditor", - params: { id: nodeId }, + params: { node: nodeId }, query: folderParams, }); url = url.fullPath; diff --git a/assets/vue/mixins/UpdateMixin.js b/assets/vue/mixins/UpdateMixin.js index c1bef5b23b..291857fde1 100644 --- a/assets/vue/mixins/UpdateMixin.js +++ b/assets/vue/mixins/UpdateMixin.js @@ -130,7 +130,8 @@ export default { updated(val) { console.log('updated'); - this.showMessage(`${val['@id']} updated.`); + //this.showMessage(`${val['@id']} updated.`); + this.$router.go(-1); }, retrieved(val) { From 4dbb9559cdc757965a150bf3e9b610ce3ab89353 Mon Sep 17 00:00:00 2001 From: christian Date: Mon, 6 Nov 2023 00:24:09 -0500 Subject: [PATCH 2/2] Course: Display resources in filemanager - refs BT#21046 --- assets/vue/components/ctoolintro/Form.vue | 11 ++++++----- assets/vue/views/course/CourseHome.vue | 5 +++-- assets/vue/views/ctoolintro/Update.vue | 14 ++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/assets/vue/components/ctoolintro/Form.vue b/assets/vue/components/ctoolintro/Form.vue index 4a1b3aaa17..bc0e7618bf 100644 --- a/assets/vue/components/ctoolintro/Form.vue +++ b/assets/vue/components/ctoolintro/Form.vue @@ -33,6 +33,7 @@ import useVuelidate from "@vuelidate/core"; import { ref } from "vue"; import { usePlatformConfig } from "../../store/platformConfig"; +import {useRoute} from "vue-router"; export default { name: "ToolIntroForm", props: { @@ -58,7 +59,10 @@ export default { extraPlugins.value = "translatehtml"; } - return { v$: useVuelidate(), extraPlugins }; + const route = useRoute(); + const parentResourceNodeId = ref(route.query.parentResourceNodeId); + + return { v$: useVuelidate(), extraPlugins, parentResourceNodeId}; }, data() { return { @@ -77,10 +81,7 @@ export default { }, methods: { browser(callback, value, meta) { - let nodeId = this.$route.query.ctoolId; - if (!nodeId) { - nodeId = this.$route.params.courseTool; - } + let nodeId = this.parentResourceNodeId; let folderParams = this.$route.query; let url = this.$router.resolve({ name: "DocumentForHtmlEditor", diff --git a/assets/vue/views/course/CourseHome.vue b/assets/vue/views/course/CourseHome.vue index 52c98897af..b487c06d13 100644 --- a/assets/vue/views/course/CourseHome.vue +++ b/assets/vue/views/course/CourseHome.vue @@ -94,7 +94,7 @@ :label="t('Edit introduction')" icon="edit" type="black" - @click="createInSession ? addIntro(course, intro) : updateIntro(intro)" + @click="createInSession ? addIntro(course, intro) : updateIntro(course, intro)" /> @@ -372,7 +372,7 @@ function addIntro(course, intro) { }) } -function updateIntro(intro) { +function updateIntro(course, intro) { return router.push({ name: "ToolIntroUpdate", params: { id: "/api/c_tool_intros/" + intro.iid }, @@ -381,6 +381,7 @@ function updateIntro(intro) { sid: sessionId, ctoolintroIid: intro.iid, ctoolId: intro.c_tool.iid, + parentResourceNodeId: course.resourceNode.id, id: "/api/c_tool_intros/" + intro.iid, }, }) diff --git a/assets/vue/views/ctoolintro/Update.vue b/assets/vue/views/ctoolintro/Update.vue index 23799f8cdf..ed7e5df16c 100644 --- a/assets/vue/views/ctoolintro/Update.vue +++ b/assets/vue/views/ctoolintro/Update.vue @@ -49,19 +49,17 @@ export default { let ctoolintroId = route.query.ctoolintroIid // Get the current intro text. - axios - .get(ENTRYPOINT + "c_tool_intros/" + ctoolintroId) + axios.get(ENTRYPOINT + "c_tool_intros/" + ctoolintroId) .then((response) => { - let data = response.data - item.value["introText"] = data.introText + let data = response.data; + item.value["introText"] = data.introText; + item.value["parentResourceNodeId"] = Number(route.query.parentResourceNodeId); }) .catch(function (error) { - console.log(error) - }) + console.error(error); + }); - item.value["parentResourceNodeId"] = Number(route.query.parentResourceNodeId) item.value["courseTool"] = "/api/c_tools/" + toolId - item.value["resourceLinkList"] = [ { sid,