Added more filters to the classroom
This commit is contained in:
@@ -49,7 +49,7 @@ export const getServerSideProps = withIronSessionSsr(async ({req, res, params})
|
||||
if (!assignment) return redirect("/assignments")
|
||||
|
||||
const entities = await (checkAccess(user, ["developer", "admin"]) ? getEntitiesWithRoles() : getEntitiesWithRoles(entityIDS));
|
||||
const entity = entities.find((e) => assignment.entity === assignment.entity)
|
||||
const entity = entities.find((e) => e.id === assignment.entity)
|
||||
|
||||
if (!entity) return redirect("/assignments")
|
||||
if (!doesEntityAllow(user, entity, 'edit_assignment')) return redirect("/assignments")
|
||||
@@ -197,6 +197,12 @@ export default function AssignmentsPage({assignment, user, users, entities, grou
|
||||
}
|
||||
};
|
||||
|
||||
const copyLink = async () => {
|
||||
const origin = window.location.origin
|
||||
await navigator.clipboard.writeText(`${origin}/exam?assignment=${assignment.id}`)
|
||||
toast.success("The URL to the assignment has been copied to your clipboard!")
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
@@ -558,6 +564,9 @@ export default function AssignmentsPage({assignment, user, users, entities, grou
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div className="flex gap-4 w-full justify-end">
|
||||
<Button variant="outline" color="purple" className="w-full max-w-[200px]" onClick={copyLink}>
|
||||
Copy Link
|
||||
</Button>
|
||||
<Button
|
||||
className="w-full max-w-[200px]"
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user