Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: error template slots #388

Merged
merged 10 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
6 changes: 4 additions & 2 deletions frontend/src/assets/lang/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"scoreVisibility": "Make score, when uploaded, automatically visible to students",
"dockerUpload": "Upload a Dockerfile",
"submissionStructure": "Structure of how a submission should be made",
"noStudents": "No students in this group"
"noStudents": "No students in this group",
"locked": "Closed",
"unlocked": "Open"
},
"submissions": {
"title": "Submissions",
Expand All @@ -97,6 +99,7 @@
"clone": "Clone course",
"cloneAssistants": "Clone assistants:",
"cloneTeachers": "Clone teachers:",
"cloneCourse": "Clone teachers:",
"name": "Course name",
"description": "Description",
"excerpt": "Short description",
Expand Down Expand Up @@ -137,7 +140,6 @@
"duration": "Validity period link (in days):",
"link": "Invitation link:"
}

}
},
"composables": {
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/components/courses/CourseGeneralList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ watch(user, loadCourses, { immediate: true });
<template v-else>
<div class="w-30rem text-center mx-auto">
<span class="pi pi-exclamation-circle text-6xl text-primary" />
<p>{{ t('components.list.noCourses') }}</p>
<RouterLink :to="{ name: 'courses' }" v-if="user?.isStudent()">
<Button :label="t('components.button.searchCourse')" icon="pi pi-search" />
</RouterLink>
<RouterLink :to="{ name: 'course-create' }" v-else>
<Button :label="t('components.button.createCourse')" icon="pi pi-plus" />
</RouterLink>
<slot name="empty">
<p>{{ t('components.list.noCourses') }}</p>
<RouterLink :to="{ name: 'courses' }">
<Button :label="t('components.button.searchCourse')" icon="pi pi-search" />
</RouterLink>
</slot>
</div>
</template>
</template>
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/projects/ProjectInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const { t } = useI18n();

<template>
<div class="flex align-items-center flex-wrap gap-3 surface-50 p-3">
<span class="flex align-items-center">
<template v-if="project.isLocked()">
<i class="pi pi-lock mr-2" />
{{ t('views.projects.locked') }}
</template>
<template v-else>
<i class="pi pi-unlock mr-2" />
{{ t('views.projects.unlocked') }}
</template>
</span>
<span class="flex align-items-center">
<i class="pi pi-play mr-2" />
{{ project.getFormattedStartDate() }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Project {
* @returns True if the project is locked, false otherwise.
*/
public isLocked(): boolean {
return !this.visible || this.archived || this.locked_groups || moment(this.start_date).isAfter();
return !this.visible || this.archived || this.locked_groups || moment(this.start_date).isBefore();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ watch(message, () => {
}

// Add the message to the toast.
add({ ...message.value, life: 5000000 });
add({ ...message.value, life: 4000 });
}
});
</script>
Expand Down
98 changes: 49 additions & 49 deletions frontend/src/views/courses/SearchCourseView.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<script setup lang="ts">
import SelectButton from 'primevue/selectbutton';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import PublicSearchCourseView from './search/PublicSearchCourseView.vue';
import ProtectedSearchCourseView from './search/ProtectedSearchCourseView.vue';

/* Composable injections */
const { t } = useI18n();

/* State of the public/protected course */
const publicCourses = ref<boolean>(true);

/* Options for the select button */
const options = computed(() => [
{ label: t('components.button.public'), value: true },
{ label: t('components.button.protected'), value: false },
]);
</script>

<template>
<!-- If the public option is set, display the search option for all the public courses -->
<PublicSearchCourseView v-if="publicCourses">
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</PublicSearchCourseView>

<!-- If the protected option is set, display the search option for all the protected courses -->
<ProtectedSearchCourseView v-else>
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</ProtectedSearchCourseView>
</template>

<style scoped lang="scss"></style>
<script setup lang="ts">
import SelectButton from 'primevue/selectbutton';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import PublicSearchCourseView from './search/PublicSearchCourseView.vue';
import ProtectedSearchCourseView from './search/ProtectedSearchCourseView.vue';
/* Composable injections */
const { t } = useI18n();
/* State of the public/protected course */
const publicCourses = ref<boolean>(true);
/* Options for the select button */
const options = computed(() => [
{ label: t('components.button.public'), value: true },
{ label: t('components.button.protected'), value: false },
]);
</script>
<template>
<!-- If the public option is set, display the search option for all the public courses -->
<PublicSearchCourseView v-if="publicCourses">
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</PublicSearchCourseView>
<!-- If the protected option is set, display the search option for all the protected courses -->
<ProtectedSearchCourseView v-else>
<template #publicButton>
<SelectButton
v-model="publicCourses"
:options="options"
option-value="value"
option-label="label"
:allow-empty="false"
/>
</template>
</ProtectedSearchCourseView>
</template>
<style scoped lang="scss"></style>
2 changes: 1 addition & 1 deletion frontend/src/views/courses/roles/TeacherCourseView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ProjectList from '@/components/projects/ProjectList.vue';
import TeacherAssistantList from '@/components/teachers_assistants/TeacherAssistantList.vue';
import ProjectCreateButton from '@/components/projects/ProjectCreateButton.vue';
import TeacherAssistantUpdateButton from '@/components/teachers_assistants/TeacherAssistantUpdateButton.vue';
import ShareCourseButton from '@/components/courses/ShareCourseButton.vue';
import Button from 'primevue/button';
import ButtonGroup from 'primevue/buttongroup';
import InputSwitch from 'primevue/inputswitch';
Expand All @@ -16,7 +17,6 @@ import { PrimeIcons } from 'primevue/api';
import { useCourses } from '@/composables/services/course.service';
import { useProject } from '@/composables/services/project.service.ts';
import { computed, ref, watch } from 'vue';
import ShareCourseButton from '@/components/courses/ShareCourseButton.vue';

/* Props */
const props = defineProps<{
Expand Down