Skip to content

Commit 1642942

Browse files
committed
Admin: Add CMS pages categories FAQ and Contact + fix loading in existing Home.vue - refs BT#20918
1 parent 323a9b7 commit 1642942

File tree

8 files changed

+96
-3
lines changed

8 files changed

+96
-3
lines changed

assets/vue/components/page/PageCardList.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div
33
v-if="pageList.length"
4-
class="grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-2"
54
>
65
<PageCard
76
v-for="page in pageList"

assets/vue/pages/Contact.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<!-- List of pages of category "contact" -->
3+
<div class="container mx-auto flex gap-8">
4+
<div v-if="pages.length" class="flex-1">
5+
<PageCardList :pages="pages" class="grid gap-4 grid-cols-1" />
6+
</div>
7+
</div>
8+
</template>
9+
10+
<script setup>
11+
import { ref } from "vue";
12+
import { useStore } from "vuex";
13+
import { useI18n } from "vue-i18n";
14+
import PageCardList from "../components/page/PageCardList";
15+
16+
const store = useStore();
17+
const { locale } = useI18n();
18+
19+
const pages = ref([]);
20+
21+
store
22+
.dispatch("page/findAll", {
23+
"category.title": "contact",
24+
enabled: "1",
25+
locale: locale.value,
26+
})
27+
.then((response) => (pages.value = response));
28+
</script>

assets/vue/pages/Faq.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<!-- List of pages of category "faq" -->
3+
<div class="container mx-auto flex gap-8">
4+
<div v-if="pages.length" class="flex-1">
5+
<PageCardList :pages="pages" class="grid gap-4 grid-cols-1" />
6+
</div>
7+
</div>
8+
</template>
9+
10+
<script setup>
11+
import { ref } from "vue";
12+
import { useStore } from "vuex";
13+
import { useI18n } from "vue-i18n";
14+
import PageCardList from "../components/page/PageCardList";
15+
16+
const store = useStore();
17+
const { locale } = useI18n();
18+
19+
const pages = ref([]);
20+
21+
store
22+
.dispatch("page/findAll", {
23+
"category.title": "faq",
24+
enabled: "1",
25+
locale: locale.value,
26+
})
27+
.then((response) => (pages.value = response));
28+
</script>

assets/vue/pages/Home.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<template>
2+
<!-- Homepage for logged-in users -->
23
<div class="flex flex-col gap-4">
34
<div v-if="announcements.length">
45
<SystemAnnouncementCardList :announcements="announcements" />
56
</div>
67

7-
<PageCardList />
8+
<PageCardList class="grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-2" />
89
</div>
910
</template>
1011

assets/vue/pages/Index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<template>
2+
<!-- Public homepage (no login required) -->
23
<div class="container mx-auto flex gap-8">
34
<Login class="md:w-4/12 lg:order-1" />
45
<div v-if="pages.length" class="flex-1 md:w-8/12 lg:order-0">
5-
<PageCardList :pages="pages" />
6+
<PageCardList :pages="pages" class="grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-2" />
67
</div>
78
</div>
89
</template>

assets/vue/router/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import CourseHome from "../views/course/CourseHome.vue"
3333
import Index from "../pages/Index.vue"
3434
import Home from "../pages/Home.vue"
3535
import Login from "../pages/Login.vue"
36+
import Faq from "../pages/Faq.vue"
37+
import Contact from "../pages/Contact.vue"
3638
import { useCidReqStore } from "../store/cidReq"
3739

3840
const router = createRouter({
@@ -64,6 +66,24 @@ const router = createRouter({
6466
showBreadcrumb: false,
6567
},
6668
},
69+
{
70+
path: "/faq",
71+
name: "Faq",
72+
component: Faq,
73+
meta: {
74+
requiresAuth: false,
75+
showBreadcrumb: false,
76+
},
77+
},
78+
{
79+
path: "/contact",
80+
name: "Contact",
81+
component: Contact,
82+
meta: {
83+
requiresAuth: false,
84+
showBreadcrumb: false,
85+
},
86+
},
6787
{
6888
path: "/course/:id/home",
6989
name: "CourseHome",

src/CoreBundle/Component/Utils/CreateDefaultPages.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public function createDefaultPages(User $user, AccessUrl $url, string $locale):
4646
;
4747
$this->pageCategoryRepository->update($indexCategory);
4848

49+
$indexCategory = (new PageCategory())
50+
->setTitle('faq')
51+
->setType('grid')
52+
->setCreator($user)
53+
;
54+
$this->pageCategoryRepository->update($indexCategory);
55+
56+
$indexCategory = (new PageCategory())
57+
->setTitle('contact')
58+
->setType('grid')
59+
->setCreator($user)
60+
;
61+
$this->pageCategoryRepository->update($indexCategory);
62+
4963
$page = (new Page())
5064
->setTitle('Welcome')
5165
->setContent('Welcome to Chamilo')

src/CoreBundle/Controller/IndexController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class IndexController extends BaseController
1818
* @Route("/", name="index", methods={"GET", "POST"}, options={"expose"=true})
1919
* @Route("/home", name="home", methods={"GET", "POST"}, options={"expose"=true})
2020
* @Route("/login", name="login", methods={"GET", "POST"}, options={"expose"=true})
21+
* @Route("/faq", name="faq", methods={"GET", "POST"}, options={"expose"=true})
22+
* @Route("/contact", name="contact", methods={"GET", "POST"}, options={"expose"=true})
2123
*
2224
* @Route("/course/{cid}/home", name="chamilo_core_course_home")
2325
* @Route("/courses", name="courses", methods={"GET", "POST"}, options={"expose"=true})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy