From 28ced6f79ed8d4d33056dc2100dbb2b8d6a3fb92 Mon Sep 17 00:00:00 2001 From: Mathis De Witte Date: Tue, 21 May 2024 17:37:47 +0200 Subject: [PATCH] fix opened template code --- .../pages/addChangeAssignmentPage/RestrictionsDialog.tsx | 9 +++++++-- frontend/frontend/vite.config.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx b/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx index 7a719850..62ee5b27 100644 --- a/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx +++ b/frontend/frontend/src/pages/addChangeAssignmentPage/RestrictionsDialog.tsx @@ -44,7 +44,7 @@ export interface Template { bestand: string } -const code = ` +/*const code = ` #@param # Schrijf in dit veld je voornaam. @@ -65,7 +65,7 @@ bestanden=["main.py", "test.py"] # de constante pi, nodig voor wanneer we de omtrek berekenen van het object dat de student indient. pi=3.14159 -#code...` +#code...`*/ /** * Dialog component for managing restrictions related to file uploads. @@ -82,6 +82,7 @@ export default function RestrictionsDialog({ const [openTextEditor, setOpenTextEditor] = useState(false) const [openTemplateInterface, setOpenTemplateInterface] = useState(false) const [openTemplateInUI, setOpenTemplateInUI] = useState(false) + const [code, setCode] = useState('' /*code*/) // code is currently not used const [textFieldContent, setTextFieldContent] = useState('') const [restrictionName, setRestrictionName] = useState('') const [restrictionType, setRestrictionType] = @@ -269,7 +270,11 @@ export default function RestrictionsDialog({ const response = await instance.get( `/templates/${template.template_id}/template/?content=true` ) + // This textFieldContent will be used when a template is opened in textmode setTextFieldContent(response.data.content) + + // The code will be used when a template is opened in the UI + setCode(response.data.content) if (openTemplateInUI) { handleClickOpenTemplateInterface() } else { diff --git a/frontend/frontend/vite.config.ts b/frontend/frontend/vite.config.ts index b9fdf55d..1a26ac5a 100644 --- a/frontend/frontend/vite.config.ts +++ b/frontend/frontend/vite.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ 'chunk-OLZKTZWI.js?v=fff2b904', 'chunk-6ZDRAOHK.js?v=fff2b904', 'chunk-BWG3R63Q.js?v=fff2b904', + 'chunk-DVKQGDAD.js?v=99d84b8c', '@mui/material/Grid', // Exclude other MUI components as needed ], },