Skip to content

Commit

Permalink
Settings go to correct referrer
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Mar 24, 2023
1 parent abe0de0 commit 0ee30ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tools/_framework/Panels/NewSupportPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function SupportPanel({ hide, children, panelTitles=[], panelInde
return (
<>
<ControlsWrapper $hide={hide} aria-label="complementary controls" data-test="Support Panel Controls">
{recoilPageToolView?.page == 'portfolioeditor' ? <Button value="Settings" onClick={()=>navigate(`/portfolio/${doenetId}/settings`)}/> : null }
{recoilPageToolView?.page == 'portfolioeditor' ? <Button value="Settings" onClick={()=>navigate(`/portfolio/${doenetId}/settings?referrer=portfolioeditor`)}/> : null }
<Button value="Documentation" onClick={()=>window.open("/public?tool=editor&doenetId=_DG5JOeFNTc5rpWuf2uA-q")}/>
</ControlsWrapper>
<SupportWrapper $hide={hide} role="complementary" data-test="Support Panel">{children}</SupportWrapper>
Expand Down
16 changes: 14 additions & 2 deletions src/Tools/_framework/Paths/PortfolioActivitySettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,29 @@ import { faFileImage } from '@fortawesome/free-solid-svg-icons';


export async function action({ request, params }) {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const referrer = urlParams.get('referrer');

const formData = await request.formData();
let updates = Object.fromEntries(formData);
let response = await axios.post("/api/updatePortfolioActivitySettings.php",{
...updates, doenetId:params.doenetId
})
// const portfolioCourseId = response.data.portfolioCourseId;

if (referrer == "portfolioeditor"){
return redirect(`/portfolioeditor?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
}else{
const portfolioCourseId = response.data.portfolioCourseId;
return redirect(`/portfolio/${portfolioCourseId}`)
}



// if (response.ok) {
// // let { doenetId } = await response.json();
// if (updates._source == "_source")
return redirect(`/portfolioeditor?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
// return redirect(`/portfolioeditor?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
// return redirect(`/portfolioeditor?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
// }else{
// return redirect(`/portfolio/${portfolioCourseId}`)
Expand Down

0 comments on commit 0ee30ff

Please sign in to comment.