From d0b7ed8fb7c182c8a22f253f837057d719cadcdc Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 22 Sep 2021 17:05:10 +0200 Subject: [PATCH] move poles to /about, resize menu #174 #191 (#194) Co-authored-by: CLIC EPFL <48416147+clicepfl@users.noreply.github.com> --- src/components/base-view.njk | 9 ---- src/pages/about/about-page-view.njk | 22 ++++++++ src/pages/about/about-page.ts | 4 +- src/pages/{ => about}/poles/assets/admin.md | 0 .../{ => about}/poles/assets/coaching.md | 0 src/pages/{ => about}/poles/assets/com.md | 0 src/pages/{ => about}/poles/assets/event.md | 0 src/pages/{ => about}/poles/assets/it.md | 0 src/pages/{ => about}/poles/assets/log.md | 0 .../poles/assets/portraits/arthurvignon.jpg | Bin .../assets/portraits/camillemontemagni.jpg | Bin .../poles/assets/portraits/default.png | Bin .../poles/assets/portraits/eloisedoyard.jpg | Bin .../poles/assets/portraits/gonxheidrizi.jpg | Bin .../poles/assets/portraits/hugoelguedj.jpg | Bin .../poles/assets/portraits/kevinfaustini.jpg | Bin .../poles/assets/portraits/maelysbillon.jpg | Bin .../poles/assets/portraits/malloryhenriet.jpg | Bin .../poles/assets/portraits/manonmichel.jpg | Bin .../poles/assets/portraits/marinebossanne.jpg | Bin .../poles/assets/portraits/rayandaod.jpg | Bin .../poles/assets/portraits/tomdemont.jpg | Bin src/pages/{ => about}/poles/assets/pres.md | 0 src/pages/{ => about}/poles/assets/sponso.md | 0 .../poles/assets/thumbnails/admin.PNG | Bin .../poles/assets/thumbnails/coaching.PNG | Bin .../poles/assets/thumbnails/com.PNG | Bin .../poles/assets/thumbnails/event.PNG | Bin .../poles/assets/thumbnails/it.PNG | Bin .../poles/assets/thumbnails/log.PNG | Bin .../poles/assets/thumbnails/pres.PNG | Bin .../poles/assets/thumbnails/sponso.PNG | Bin src/pages/{ => about}/poles/pole-list.json | 0 .../{ => about}/poles/pole-page-view.njk | 8 +-- src/pages/{ => about}/poles/pole-page.ts | 4 +- src/pages/{ => about}/poles/pole-router.ts | 2 +- src/pages/{ => about}/poles/pole.ts | 4 +- src/pages/poles/poles-page-view.njk | 51 ------------------ src/pages/poles/poles-page.ts | 23 -------- src/router.ts | 15 +----- 40 files changed, 36 insertions(+), 106 deletions(-) rename src/pages/{ => about}/poles/assets/admin.md (100%) rename src/pages/{ => about}/poles/assets/coaching.md (100%) rename src/pages/{ => about}/poles/assets/com.md (100%) rename src/pages/{ => about}/poles/assets/event.md (100%) rename src/pages/{ => about}/poles/assets/it.md (100%) rename src/pages/{ => about}/poles/assets/log.md (100%) rename src/pages/{ => about}/poles/assets/portraits/arthurvignon.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/camillemontemagni.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/default.png (100%) rename src/pages/{ => about}/poles/assets/portraits/eloisedoyard.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/gonxheidrizi.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/hugoelguedj.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/kevinfaustini.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/maelysbillon.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/malloryhenriet.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/manonmichel.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/marinebossanne.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/rayandaod.jpg (100%) rename src/pages/{ => about}/poles/assets/portraits/tomdemont.jpg (100%) rename src/pages/{ => about}/poles/assets/pres.md (100%) rename src/pages/{ => about}/poles/assets/sponso.md (100%) rename src/pages/{ => about}/poles/assets/thumbnails/admin.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/coaching.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/com.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/event.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/it.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/log.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/pres.PNG (100%) rename src/pages/{ => about}/poles/assets/thumbnails/sponso.PNG (100%) rename src/pages/{ => about}/poles/pole-list.json (100%) rename src/pages/{ => about}/poles/pole-page-view.njk (95%) rename src/pages/{ => about}/poles/pole-page.ts (83%) rename src/pages/{ => about}/poles/pole-router.ts (80%) rename src/pages/{ => about}/poles/pole.ts (97%) delete mode 100644 src/pages/poles/poles-page-view.njk delete mode 100644 src/pages/poles/poles-page.ts diff --git a/src/components/base-view.njk b/src/components/base-view.njk index 4b578be3..c43e386a 100644 --- a/src/components/base-view.njk +++ b/src/components/base-view.njk @@ -76,15 +76,9 @@ +
+
+
+

Nos Pôles

+
+ {% for row in polesList | batch(4) %} +
+ {% for item in row %} + + {% endfor %} +
+ {% endfor %} +
+
+
+
+ {{ base.footer() }} diff --git a/src/pages/about/about-page.ts b/src/pages/about/about-page.ts index 4a173e07..75d9c027 100644 --- a/src/pages/about/about-page.ts +++ b/src/pages/about/about-page.ts @@ -7,6 +7,7 @@ import { Page } from '../page' import { Request, Response } from 'express' import { Sponsor, sponsorsComponent } from '../../components/sponsors/sponsors' +import { Pole, poleComponent } from './poles/pole' /** * View model that binds the data to the template for the about page @@ -15,6 +16,7 @@ import { Sponsor, sponsorsComponent } from '../../components/sponsors/sponsors' */ class AboutPageViewModel { sponsorsList: Sponsor[] = sponsorsComponent.listValid() + polesList: Pole[] = poleComponent.list() } /** @@ -36,4 +38,4 @@ class AboutPage extends Page { * Export a single instance of the about page */ const aboutPage = new AboutPage() -export { aboutPage } \ No newline at end of file +export { aboutPage } diff --git a/src/pages/poles/assets/admin.md b/src/pages/about/poles/assets/admin.md similarity index 100% rename from src/pages/poles/assets/admin.md rename to src/pages/about/poles/assets/admin.md diff --git a/src/pages/poles/assets/coaching.md b/src/pages/about/poles/assets/coaching.md similarity index 100% rename from src/pages/poles/assets/coaching.md rename to src/pages/about/poles/assets/coaching.md diff --git a/src/pages/poles/assets/com.md b/src/pages/about/poles/assets/com.md similarity index 100% rename from src/pages/poles/assets/com.md rename to src/pages/about/poles/assets/com.md diff --git a/src/pages/poles/assets/event.md b/src/pages/about/poles/assets/event.md similarity index 100% rename from src/pages/poles/assets/event.md rename to src/pages/about/poles/assets/event.md diff --git a/src/pages/poles/assets/it.md b/src/pages/about/poles/assets/it.md similarity index 100% rename from src/pages/poles/assets/it.md rename to src/pages/about/poles/assets/it.md diff --git a/src/pages/poles/assets/log.md b/src/pages/about/poles/assets/log.md similarity index 100% rename from src/pages/poles/assets/log.md rename to src/pages/about/poles/assets/log.md diff --git a/src/pages/poles/assets/portraits/arthurvignon.jpg b/src/pages/about/poles/assets/portraits/arthurvignon.jpg similarity index 100% rename from src/pages/poles/assets/portraits/arthurvignon.jpg rename to src/pages/about/poles/assets/portraits/arthurvignon.jpg diff --git a/src/pages/poles/assets/portraits/camillemontemagni.jpg b/src/pages/about/poles/assets/portraits/camillemontemagni.jpg similarity index 100% rename from src/pages/poles/assets/portraits/camillemontemagni.jpg rename to src/pages/about/poles/assets/portraits/camillemontemagni.jpg diff --git a/src/pages/poles/assets/portraits/default.png b/src/pages/about/poles/assets/portraits/default.png similarity index 100% rename from src/pages/poles/assets/portraits/default.png rename to src/pages/about/poles/assets/portraits/default.png diff --git a/src/pages/poles/assets/portraits/eloisedoyard.jpg b/src/pages/about/poles/assets/portraits/eloisedoyard.jpg similarity index 100% rename from src/pages/poles/assets/portraits/eloisedoyard.jpg rename to src/pages/about/poles/assets/portraits/eloisedoyard.jpg diff --git a/src/pages/poles/assets/portraits/gonxheidrizi.jpg b/src/pages/about/poles/assets/portraits/gonxheidrizi.jpg similarity index 100% rename from src/pages/poles/assets/portraits/gonxheidrizi.jpg rename to src/pages/about/poles/assets/portraits/gonxheidrizi.jpg diff --git a/src/pages/poles/assets/portraits/hugoelguedj.jpg b/src/pages/about/poles/assets/portraits/hugoelguedj.jpg similarity index 100% rename from src/pages/poles/assets/portraits/hugoelguedj.jpg rename to src/pages/about/poles/assets/portraits/hugoelguedj.jpg diff --git a/src/pages/poles/assets/portraits/kevinfaustini.jpg b/src/pages/about/poles/assets/portraits/kevinfaustini.jpg similarity index 100% rename from src/pages/poles/assets/portraits/kevinfaustini.jpg rename to src/pages/about/poles/assets/portraits/kevinfaustini.jpg diff --git a/src/pages/poles/assets/portraits/maelysbillon.jpg b/src/pages/about/poles/assets/portraits/maelysbillon.jpg similarity index 100% rename from src/pages/poles/assets/portraits/maelysbillon.jpg rename to src/pages/about/poles/assets/portraits/maelysbillon.jpg diff --git a/src/pages/poles/assets/portraits/malloryhenriet.jpg b/src/pages/about/poles/assets/portraits/malloryhenriet.jpg similarity index 100% rename from src/pages/poles/assets/portraits/malloryhenriet.jpg rename to src/pages/about/poles/assets/portraits/malloryhenriet.jpg diff --git a/src/pages/poles/assets/portraits/manonmichel.jpg b/src/pages/about/poles/assets/portraits/manonmichel.jpg similarity index 100% rename from src/pages/poles/assets/portraits/manonmichel.jpg rename to src/pages/about/poles/assets/portraits/manonmichel.jpg diff --git a/src/pages/poles/assets/portraits/marinebossanne.jpg b/src/pages/about/poles/assets/portraits/marinebossanne.jpg similarity index 100% rename from src/pages/poles/assets/portraits/marinebossanne.jpg rename to src/pages/about/poles/assets/portraits/marinebossanne.jpg diff --git a/src/pages/poles/assets/portraits/rayandaod.jpg b/src/pages/about/poles/assets/portraits/rayandaod.jpg similarity index 100% rename from src/pages/poles/assets/portraits/rayandaod.jpg rename to src/pages/about/poles/assets/portraits/rayandaod.jpg diff --git a/src/pages/poles/assets/portraits/tomdemont.jpg b/src/pages/about/poles/assets/portraits/tomdemont.jpg similarity index 100% rename from src/pages/poles/assets/portraits/tomdemont.jpg rename to src/pages/about/poles/assets/portraits/tomdemont.jpg diff --git a/src/pages/poles/assets/pres.md b/src/pages/about/poles/assets/pres.md similarity index 100% rename from src/pages/poles/assets/pres.md rename to src/pages/about/poles/assets/pres.md diff --git a/src/pages/poles/assets/sponso.md b/src/pages/about/poles/assets/sponso.md similarity index 100% rename from src/pages/poles/assets/sponso.md rename to src/pages/about/poles/assets/sponso.md diff --git a/src/pages/poles/assets/thumbnails/admin.PNG b/src/pages/about/poles/assets/thumbnails/admin.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/admin.PNG rename to src/pages/about/poles/assets/thumbnails/admin.PNG diff --git a/src/pages/poles/assets/thumbnails/coaching.PNG b/src/pages/about/poles/assets/thumbnails/coaching.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/coaching.PNG rename to src/pages/about/poles/assets/thumbnails/coaching.PNG diff --git a/src/pages/poles/assets/thumbnails/com.PNG b/src/pages/about/poles/assets/thumbnails/com.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/com.PNG rename to src/pages/about/poles/assets/thumbnails/com.PNG diff --git a/src/pages/poles/assets/thumbnails/event.PNG b/src/pages/about/poles/assets/thumbnails/event.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/event.PNG rename to src/pages/about/poles/assets/thumbnails/event.PNG diff --git a/src/pages/poles/assets/thumbnails/it.PNG b/src/pages/about/poles/assets/thumbnails/it.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/it.PNG rename to src/pages/about/poles/assets/thumbnails/it.PNG diff --git a/src/pages/poles/assets/thumbnails/log.PNG b/src/pages/about/poles/assets/thumbnails/log.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/log.PNG rename to src/pages/about/poles/assets/thumbnails/log.PNG diff --git a/src/pages/poles/assets/thumbnails/pres.PNG b/src/pages/about/poles/assets/thumbnails/pres.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/pres.PNG rename to src/pages/about/poles/assets/thumbnails/pres.PNG diff --git a/src/pages/poles/assets/thumbnails/sponso.PNG b/src/pages/about/poles/assets/thumbnails/sponso.PNG similarity index 100% rename from src/pages/poles/assets/thumbnails/sponso.PNG rename to src/pages/about/poles/assets/thumbnails/sponso.PNG diff --git a/src/pages/poles/pole-list.json b/src/pages/about/poles/pole-list.json similarity index 100% rename from src/pages/poles/pole-list.json rename to src/pages/about/poles/pole-list.json diff --git a/src/pages/poles/pole-page-view.njk b/src/pages/about/poles/pole-page-view.njk similarity index 95% rename from src/pages/poles/pole-page-view.njk rename to src/pages/about/poles/pole-page-view.njk index e2199233..732c510b 100644 --- a/src/pages/poles/pole-page-view.njk +++ b/src/pages/about/poles/pole-page-view.njk @@ -16,7 +16,7 @@ - {{ base.header(tab = "poles") }} + {{ base.header(tab = "about") }}
@@ -27,7 +27,7 @@ > {{ pole.name }}

- logo + logo
{{ pole.pageBody | safe }}
@@ -79,7 +79,7 @@
- {{member.name}} + {{member.name}}

{{member.name}}

{{member.role}}

@@ -94,7 +94,7 @@ {% for teammate in pole.teammates %}
- {{teammate.name}} + {{teammate.name}}

{{teammate.name}}

Équipier

diff --git a/src/pages/poles/pole-page.ts b/src/pages/about/poles/pole-page.ts similarity index 83% rename from src/pages/poles/pole-page.ts rename to src/pages/about/poles/pole-page.ts index b946e71f..dd37f124 100644 --- a/src/pages/poles/pole-page.ts +++ b/src/pages/about/poles/pole-page.ts @@ -1,4 +1,4 @@ -import { Page } from '../page' +import { Page } from '../../page' import { Request, Response } from 'express' import { Pole } from './pole' @@ -20,7 +20,7 @@ class PolePage extends Page { /** @inheritDoc */ render = (req: Request, res: Response) => { - const template = "pages/poles/pole-page-view.njk" + const template = "pages/about/poles/pole-page-view.njk" res.render(template, this.viewModel) } diff --git a/src/pages/poles/pole-router.ts b/src/pages/about/poles/pole-router.ts similarity index 80% rename from src/pages/poles/pole-router.ts rename to src/pages/about/poles/pole-router.ts index 8d066558..ecd1c37c 100644 --- a/src/pages/poles/pole-router.ts +++ b/src/pages/about/poles/pole-router.ts @@ -4,7 +4,7 @@ import { PolePage } from './pole-page' const poleRouter = express.Router() -poleRouter.use("/", express.static("src/pages/poles/assets/")) +poleRouter.use("/", express.static("src/pages/about/poles/assets/")) poleComponent.list().forEach(pole => { poleRouter.get("/" + pole.slug, new PolePage(pole).render) diff --git a/src/pages/poles/pole.ts b/src/pages/about/poles/pole.ts similarity index 97% rename from src/pages/poles/pole.ts rename to src/pages/about/poles/pole.ts index f68c80cd..13ad51b3 100644 --- a/src/pages/poles/pole.ts +++ b/src/pages/about/poles/pole.ts @@ -2,14 +2,14 @@ import fs from 'fs' import path from 'path' import showdown from 'showdown' import data from './pole-list.json' -import { logger } from '../../logger' +import { logger } from '../../../logger' import { fstat } from 'fs' /** * Commission content path * Must correct to src/ folder since this will be compiled in dist */ -const CONTENT_PATH = path.resolve(__dirname, "../../../src/pages/poles/assets/") +const CONTENT_PATH = path.resolve(__dirname, "../../../../src/pages/about/poles/assets/") class PoleMember { name: string diff --git a/src/pages/poles/poles-page-view.njk b/src/pages/poles/poles-page-view.njk deleted file mode 100644 index e5c76cc6..00000000 --- a/src/pages/poles/poles-page-view.njk +++ /dev/null @@ -1,51 +0,0 @@ -{# - This file contains the template to render the commissions list page - CLIC website software - - Template strings are bound to the CommissionsPageViewModel defined in {@link - commissions-page.ts} - - @author Alexandre CHAU -#} -{% import "components/base-view.njk" as base %} - - - - - {{ base.head(title = "CLIC EPFL | Pôles") }} - - - - {{ base.header(tab = "poles") }} - -
-
-
-

- Home - > Pôles -

- -

Nos Pôles

- -
- {% for row in polesList | batch(4) %} -
- {% for item in row %} - - {% endfor %} -
- {% endfor %} -
-
-
-
- - {{ base.footer() }} - - diff --git a/src/pages/poles/poles-page.ts b/src/pages/poles/poles-page.ts deleted file mode 100644 index 9598555b..00000000 --- a/src/pages/poles/poles-page.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Page } from '../page' -import { Pole, poleComponent } from './pole' -import { Request, Response } from 'express' - - -class PolesPageViewModel { - polesList: Pole[] = poleComponent.list() -} - -class PolesPage extends Page { - viewModel: PolesPageViewModel = new PolesPageViewModel() - - /** @inheritDoc */ - render = (req: Request, res: Response) => { - // template path is relative to src/ as defined in web.ts - const template = "pages/poles/poles-page-view.njk" - - res.render(template, this.viewModel) - } -} - -const polesPage = new PolesPage() -export { polesPage } diff --git a/src/router.ts b/src/router.ts index 05d13066..de418187 100644 --- a/src/router.ts +++ b/src/router.ts @@ -23,8 +23,7 @@ import { coachingListRouter } from './pages/coaching/coaching-router' import { notFoundPage } from './pages/404/404-page' import { commissionRouter } from './pages/commissions/commission-router' import { commissionsPage } from './pages/commissions/commissions-page' -import { poleRouter } from './pages/poles/pole-router' -import { polesPage } from './pages/poles/poles-page' +import { poleRouter } from './pages/about/poles/pole-router' import { eventRouter } from './pages/events/event-router' import { eventsPage } from './pages/events/events-page' @@ -61,16 +60,6 @@ router.get('/coaching', coachingPage.render) */ router.get('/commissions', commissionsPage.render) -/** - * Poles page - */ -router.get('/poles', polesPage.render) - -/** - * Events page - */ -//router.get('/events', eventsPage.render) - /** * Sponsors router * Routes defined in {@link components/sponsors/sponsors-router.ts} will be @@ -119,7 +108,7 @@ router.use("/coaching", coachingListRouter) router.use("/commissions", commissionRouter) -router.use("/poles", poleRouter) +router.use("/about", poleRouter) router.use("/events", eventRouter)