-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from SELab-2/project_creation
Project creation
- Loading branch information
Showing
14 changed files
with
622 additions
and
83 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup lang="ts"> | ||
/* Props */ | ||
const props = defineProps<{ field: any }>(); | ||
</script> | ||
|
||
<template> | ||
<span v-if="props.field.$error" class="p-error">{{ props.field.$errors[0].$message }}</span> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.p-error { | ||
display: block; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script setup lang="ts"> | ||
import { useI18n } from 'vue-i18n'; | ||
import { type Course } from '@/types/Course.ts'; | ||
import { PrimeIcons } from 'primevue/api'; | ||
import Dialog from 'primevue/dialog'; | ||
import Button from 'primevue/button'; | ||
import { useRouter } from 'vue-router'; | ||
import { ref } from 'vue'; | ||
/* Composable injections */ | ||
const { t } = useI18n(); | ||
const { push } = useRouter(); | ||
/* Props */ | ||
const props = defineProps<{ courses: Course[] }>(); | ||
/* Dialog state to select the course you want to create a project for */ | ||
const displayCourseSelection = ref(false); | ||
/* Method to route to the project creation view */ | ||
const createProjectForCourse = (courseId: string): void => { | ||
push({ name: 'project-create', params: { courseId } }); | ||
displayCourseSelection.value = false; | ||
}; | ||
</script> | ||
|
||
<template> | ||
<!-- Button to create a new project --> | ||
<Button | ||
v-if="props.courses && props.courses.length > 0" | ||
:icon="PrimeIcons.PLUS" | ||
icon-pos="right" | ||
class="custom-button" | ||
@click="displayCourseSelection = true" | ||
/> | ||
<!-- Dialog to select the course you want to create a project for --> | ||
<Dialog | ||
v-model:visible="displayCourseSelection" | ||
modal | ||
:draggable="false" | ||
:contentStyle="{ width: '50vw' }" | ||
:header="t('views.dashboard.select_course')" | ||
> | ||
<!-- List of courses to select from--> | ||
<div v-if="props.courses && props.courses.length > 0"> | ||
<div | ||
v-for="course in props.courses" | ||
:key="course.id" | ||
class="course-item" | ||
@click="createProjectForCourse(course.id)" | ||
> | ||
<span class="course-name">{{ course.name }}</span> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.course-item { | ||
cursor: pointer; | ||
padding: 8px; | ||
border-radius: 4px; | ||
margin-bottom: 8px; | ||
transition: background-color 0.3s; | ||
} | ||
.course-item:hover { | ||
background-color: #f0f0f0; | ||
} | ||
.course-name { | ||
font-weight: bold; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.