diff --git a/daikoku/app/controllers/HomeController.scala b/daikoku/app/controllers/HomeController.scala index f9ed8b16c..1b8f77cbd 100644 --- a/daikoku/app/controllers/HomeController.scala +++ b/daikoku/app/controllers/HomeController.scala @@ -300,7 +300,20 @@ class HomeController( case Some(page) if !page.visible => cmsPageNotFound(ctx) case Some(page) if page.authenticated && ctx.user.isEmpty => redirectToLoginPage(ctx) - case Some(page) => render(ctx, page) + case Some(page) => + val uri = ctx.request.uri + if (uri.contains("/mails/") && !uri.contains("/mails/root/tenant-mail-template")) { + env.dataStore.cmsRepo.forTenant(ctx.tenant) + .findById("-mails-root-tenant-mail-template-fr") + .flatMap { + case None => render(ctx, page) + case Some(layout) => + val fields = Map("email" -> JsString(page.body)) + render(ctx, layout, skipCache = true, fields = fields) + } + } else { + render(ctx, page) + } } } diff --git a/daikoku/javascript/src/components/adminbackoffice/cms/Pages.tsx b/daikoku/javascript/src/components/adminbackoffice/cms/Pages.tsx index 505954448..07d1d27b6 100644 --- a/daikoku/javascript/src/components/adminbackoffice/cms/Pages.tsx +++ b/daikoku/javascript/src/components/adminbackoffice/cms/Pages.tsx @@ -1,12 +1,9 @@ import { createColumnHelper } from '@tanstack/react-table'; -import classNames from 'classnames'; -import moment from 'moment'; -import React, { useContext, useEffect, useRef } from 'react'; +import { useContext, useEffect, useRef } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { IPage } from '..'; import { ModalContext } from '../../../contexts'; import { I18nContext } from '../../../contexts'; -import * as Services from '../../../services'; import { Table, TableRef } from '../../inputs'; export const CONTENT_TYPES = [ @@ -20,16 +17,13 @@ export const CONTENT_TYPES = [ ]; type PagesProps = { - pages: Array, - removePage: (page: string) => void + pages: Array } export const Pages = ({ - pages, - removePage + pages }: PagesProps) => { const table = useRef() const { translate } = useContext(I18nContext); - const { alert, confirm } = useContext(ModalContext); useEffect(() => { if (table.current) @@ -78,11 +72,6 @@ export const Pages = ({ cell: (info) => info.getValue() || {translate('cms.pages.block')} }), - columnHelper.accessor(row => row.lastPublishedDate ? moment(row.lastPublishedDate).format(translate('moment.date.format')) : '-', { - header: translate('cms.pages.publish_date'), - meta: { style: { textAlign: 'left', width: '200px' } }, - enableColumnFilter: false, - }), columnHelper.display({ header: 'Actions', meta: { style: { textAlign: 'center', width: '120px' } }, @@ -90,16 +79,11 @@ export const Pages = ({ enableSorting: false, cell: (info) => { const value = info.row.original; - let isCreatedFromCLI = false; - - try { - isCreatedFromCLI = !!JSON.parse(info.row.original.metadata).from - } catch (_) { } const itemPath = value.path ? (value.path.startsWith('/') ? `/_${value.path}` : `/_/${value.path}`) : '#' return ( -
+
e.stopPropagation()}> @@ -118,25 +102,6 @@ export const Pages = ({ } - {!isCreatedFromCLI && }
); }, diff --git a/daikoku/javascript/src/components/adminbackoffice/cms/index.tsx b/daikoku/javascript/src/components/adminbackoffice/cms/index.tsx index a815d9b5d..6b71653e5 100644 --- a/daikoku/javascript/src/components/adminbackoffice/cms/index.tsx +++ b/daikoku/javascript/src/components/adminbackoffice/cms/index.tsx @@ -1,13 +1,13 @@ import { getApolloContext, gql } from '@apollo/client'; -import { useContext, useEffect, useRef, useState } from 'react'; -import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'; +import { useContext, useEffect, useState } from 'react'; +import { Route, Routes, useLocation } from 'react-router-dom'; import { I18nContext } from '../../../contexts'; import { Can, manage, tenant } from '../../utils'; import { Create } from './Create'; -import { CONTENT_TYPES, Pages } from './Pages'; +import { Pages } from './Pages'; import * as Services from '../../../services'; import { Spinner } from '../..'; -import { ModalContext, useTenantBackOffice } from '../../../contexts'; +import { useTenantBackOffice } from '../../../contexts'; export interface IPage { id: string @@ -86,7 +86,7 @@ export const CMSOffice = () => {
- setPages(cmsPages.filter((f) => f.id !== id))} /> + ); }; diff --git a/daikoku/test/daikoku/suites.scala b/daikoku/test/daikoku/suites.scala index 5125e7651..541774f65 100644 --- a/daikoku/test/daikoku/suites.scala +++ b/daikoku/test/daikoku/suites.scala @@ -1412,7 +1412,6 @@ object utils { forwardRef = None, tags = List(), metadata = Map(), - draft = "

draft content

", contentType = "text/html", body = "

production content

", path = Some("/" + IdGenerator.token(32))