CLASSROOMIO-T-180: Make exercise answerable
This commit is contained in:
@@ -68,8 +68,8 @@
|
|||||||
|
|
||||||
<PageBody padding="px-4" headerClassName="bg-gray-100 rounded-md mb-3">
|
<PageBody padding="px-4" headerClassName="bg-gray-100 rounded-md mb-3">
|
||||||
<svelte:fragment slot="header">
|
<svelte:fragment slot="header">
|
||||||
<div class="flex items-center py-2 w-">
|
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
||||||
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
<div class="flex items-center py-2 w-">
|
||||||
{#if $exerciseMode.editMode}
|
{#if $exerciseMode.editMode}
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
className="mr-2"
|
className="mr-2"
|
||||||
@@ -94,8 +94,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{/if}
|
{/if}
|
||||||
</RoleBasedSecurity>
|
</div>
|
||||||
</div>
|
</RoleBasedSecurity>
|
||||||
|
|
||||||
{#if $exerciseMode.editMode}
|
{#if $exerciseMode.editMode}
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
export let path;
|
export let path;
|
||||||
export let exerciseId;
|
export let exerciseId;
|
||||||
export let lessonId;
|
export let lessonId;
|
||||||
|
export let isStudent = true;
|
||||||
|
|
||||||
let open = false;
|
let open = false;
|
||||||
let isFetching = false;
|
let isFetching = false;
|
||||||
@@ -123,11 +124,9 @@
|
|||||||
getExercises();
|
getExercises();
|
||||||
});
|
});
|
||||||
|
|
||||||
const gotoEdit = () => {
|
|
||||||
$exerciseMode.editMode = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
$: getExercise(exerciseId);
|
$: getExercise(exerciseId);
|
||||||
|
|
||||||
|
$: $exerciseMode.editMode = !isStudent;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if isFetching}
|
{#if isFetching}
|
||||||
@@ -159,7 +158,6 @@
|
|||||||
<a
|
<a
|
||||||
class="w-52 bg-gray-100 dark:bg-neutral-800 px-4 py-7 mr-4 mb-4 rounded-lg"
|
class="w-52 bg-gray-100 dark:bg-neutral-800 px-4 py-7 mr-4 mb-4 rounded-lg"
|
||||||
href="{path}/{exercise.id}"
|
href="{path}/{exercise.id}"
|
||||||
on:click={gotoEdit}
|
|
||||||
>
|
>
|
||||||
<h3 class="dark:text-white text-xl">{exercise.title}</h3>
|
<h3 class="dark:text-white text-xl">{exercise.title}</h3>
|
||||||
<p class="dark:text-white mt-4 text-sm">Created Jul 3, 2021</p>
|
<p class="dark:text-white mt-4 text-sm">Created Jul 3, 2021</p>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
||||||
import RadioItem from '$lib/components/Form/RadioItem.svelte';
|
import RadioItem from '$lib/components/Form/RadioItem.svelte';
|
||||||
import TextField from '$lib/components/Form/TextField.svelte';
|
import TextField from '$lib/components/Form/TextField.svelte';
|
||||||
|
import HtmlRender from '$lib/components/HTMLRender/HTMLRender.svelte';
|
||||||
|
|
||||||
export let title = '';
|
export let title = '';
|
||||||
export let code = '';
|
export let code = '';
|
||||||
@@ -62,9 +63,13 @@
|
|||||||
|
|
||||||
<form on:submit|preventDefault={handleFormSubmit}>
|
<form on:submit|preventDefault={handleFormSubmit}>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h3 class="dark:text-white {labelClassName} {!isNaN(grade) && 'w-3/4'}">
|
<HtmlRender className="mt-4">
|
||||||
{title}
|
<svelte:fragment slot="content">
|
||||||
</h3>
|
<h3 class="dark:text-white {labelClassName} {!isNaN(grade) && 'w-3/4'}">
|
||||||
|
{title}
|
||||||
|
</h3>
|
||||||
|
</svelte:fragment>
|
||||||
|
</HtmlRender>
|
||||||
{#if !isNaN(grade)}
|
{#if !isNaN(grade)}
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<TextField
|
<TextField
|
||||||
@@ -112,9 +117,7 @@
|
|||||||
variant={VARIANTS.OUTLINED}
|
variant={VARIANTS.OUTLINED}
|
||||||
/>
|
/>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
variant={nextButtonProps.isActive
|
variant={nextButtonProps.isActive ? VARIANTS.CONTAINED : VARIANTS.OUTLINED}
|
||||||
? VARIANTS.CONTAINED
|
|
||||||
: VARIANTS.OUTLINED}
|
|
||||||
type="submit"
|
type="submit"
|
||||||
label={nextButtonProps.label}
|
label={nextButtonProps.label}
|
||||||
{name}
|
{name}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
if (data.isOrgSite) {
|
if (data.isOrgSite) {
|
||||||
if (params.has('redirect')) {
|
if (params.has('redirect')) {
|
||||||
goto(params.get('redirect') || '');
|
goto(params.get('redirect') || '');
|
||||||
} else if (!path.includes('lms')) {
|
} else if (shouldRedirectOnAuth(path)) {
|
||||||
goto('/lms');
|
goto('/lms');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
import TextChip from '$lib/components/Chip/Text.svelte';
|
import TextChip from '$lib/components/Chip/Text.svelte';
|
||||||
import Avatar from '$lib/components/Apps/components/Poll/components/Avatar.svelte';
|
import Avatar from '$lib/components/Apps/components/Poll/components/Avatar.svelte';
|
||||||
import AddLessonModal from '$lib/components/Course/components/Lesson/AddLessonModal.svelte';
|
import AddLessonModal from '$lib/components/Course/components/Lesson/AddLessonModal.svelte';
|
||||||
import { exerciseMode } from '$lib/components/Course/components/Lesson/Exercise/store';
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
const { courseId } = data;
|
const { courseId } = data;
|
||||||
|
|
||||||
let lessonEditing;
|
let lessonEditing;
|
||||||
let isStudent = true;
|
let isStudent = true;
|
||||||
let openModal = false;
|
let openModal = false;
|
||||||
@@ -99,10 +99,6 @@
|
|||||||
isStudent = user.role_id === 3;
|
isStudent = user.role_id === 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$: {
|
|
||||||
console.log('isStudent', isStudent);
|
|
||||||
$exerciseMode.editMode = !isStudent;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AddLessonModal {isStudent} bind:openModal />
|
<AddLessonModal {isStudent} bind:openModal />
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
let isMarkingComplete = false;
|
let isMarkingComplete = false;
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let isSaving = false;
|
let isSaving = false;
|
||||||
|
let isStudent = true;
|
||||||
|
|
||||||
function getLessonOrder(id: string) {
|
function getLessonOrder(id: string) {
|
||||||
const index = $lessons.findIndex((lesson) => lesson.id === id);
|
const index = $lessons.findIndex((lesson) => lesson.id === id);
|
||||||
@@ -200,7 +201,11 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CourseContainer {path} isExercisePage={!data.isMaterialsTabActive && data.exerciseId}>
|
<CourseContainer
|
||||||
|
bind:isStudent
|
||||||
|
{path}
|
||||||
|
isExercisePage={!data.isMaterialsTabActive && data.exerciseId}
|
||||||
|
>
|
||||||
<PageNav
|
<PageNav
|
||||||
navItems={[
|
navItems={[
|
||||||
{
|
{
|
||||||
@@ -256,7 +261,12 @@
|
|||||||
</PageNav>
|
</PageNav>
|
||||||
|
|
||||||
{#if !data.isMaterialsTabActive}
|
{#if !data.isMaterialsTabActive}
|
||||||
<Exercises lessonId={data.lessonId} exerciseId={data.exerciseId} path={`${path}/exercises`} />
|
<Exercises
|
||||||
|
bind:isStudent
|
||||||
|
lessonId={data.lessonId}
|
||||||
|
exerciseId={data.exerciseId}
|
||||||
|
path={`${path}/exercises`}
|
||||||
|
/>
|
||||||
{:else if !!data.lessonId}
|
{:else if !!data.lessonId}
|
||||||
<PageBody
|
<PageBody
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user