diff --git a/frontend/src/Apps/Forums.vue b/frontend/src/Apps/Forums.vue new file mode 100644 index 0000000..3e777e2 --- /dev/null +++ b/frontend/src/Apps/Forums.vue @@ -0,0 +1,138 @@ + + + + + + + + diff --git a/frontend/src/rest/apps.js b/frontend/src/rest/apps.js index 99cbc10..344e22a 100644 --- a/frontend/src/rest/apps.js +++ b/frontend/src/rest/apps.js @@ -9,6 +9,7 @@ import Profil from "@/Apps/Profil.vue" import Courses from "@/Apps/ManageCourses.vue" import Users from "@/Apps/UsersList.vue" import Students from "@/Apps/StudentsList.vue" +import Forums from '@/Apps/Forums.vue' const apps = { '/login': LoginPage, @@ -17,12 +18,13 @@ const apps = { '/manage-courses' : Courses, '/users-list' : Users, '/students-list' : Students, + '/forums': Forums, } const appsList = { 'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") }, 'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") }, - 'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") }, + 'Forum': { path: '#/forums', icon: 'fa-envelope', text: i18n("app.forum") }, 'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") }, 'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") }, 'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") }, diff --git a/frontend/src/rest/forum.js b/frontend/src/rest/forum.js new file mode 100644 index 0000000..7920a33 --- /dev/null +++ b/frontend/src/rest/forum.js @@ -0,0 +1,71 @@ +import { ref } from 'vue' +import { restGet, restPost, restDelete, restPatch } from './restConsumer.js' + +/** + * List forums of a course + */ +export async function getForumsOfCourse(id){ + ForumsOfCurrentCourse.value = [ + { + id: 1, + name: "forum~1" + }, + { + id: 2, + name: "forum~2" + }, + ] + // ForumsOfCurrentCourse = await restGet("/forums/" + id) +} + +export const ForumsOfCurrentCourse = ref(); + +/** + * List post of a specified forum + */ +export async function getPostsOfForum(id){ + PostsOfCurrentForum.value = [ + { + id: 1, + name: "Post~1" + }, + { + id: 2, + name: "Post~2" + }, + ] + // PostsCurrentForum.value = await restGet("/forum/" + id); +} + +export const PostsOfCurrentForum = ref(); + +/** + * Get a post and its responses + */ +export async function fetchPost(id){ + fetchedPost.value = { + id: 1, + subject: "This is the subject of the post", + content: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", + messages: [ + { + id: 1, + author: "author~1", + content: "J'ai pas copris le message !" + }, + { + id: 2, + author: "author~2", + content: "tu as fait une faute dans ton message..." + }, + { + id: 3, + author: null, + content: "I'm anonymous noww..." + } + ] + } + // fetchedPost.value = await restGet("/forum/post/" + id); +} + +export const fetchedPost = ref();