Skip to content

Conversation

tuj
Copy link
Contributor

@tuj tuj commented Aug 13, 2025

Link to issue

#249

Description

Refactored how templates are handled:

  • Instead of loading the template admin elements with fetch, include json config in js build.
  • Moved template folder to assets/ folder.
  • Removed unused config elements from template folders.
  • Added support for custom templates through the assets/shared/custom-templates/.
  • Added commands for handling templates.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@tuj tuj self-assigned this Aug 13, 2025
@tuj tuj added the enhancement New feature or request label Aug 13, 2025
@tuj tuj added this to the 3.0.0 milestone Aug 20, 2025
@tuj tuj marked this pull request as ready for review August 22, 2025 12:07
@tuj tuj mentioned this pull request Aug 22, 2025
33 tasks
// @see docs/custom-templates.md
const templateModules = import.meta.glob("../templates/*.jsx", { eager: true });
const customTemplatesModules = import.meta.glob("../custom-templates/*.jsx", {
eager: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why eager: true,?


The following files are required for a custom template:

* custom-template-name.jsx - A javascript module for the template.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess technically it is a JavaScript XML module if it is .jsx

@@ -1,7 +1,7 @@
import { React, useContext } from "react";
import PropTypes from "prop-types";
import UserContext from "./context/user-context";
import NoAccess from "./components/no-access/no-access";
import UserContext from "../context/user-context.jsx";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why .jsx ?

@@ -92,6 +93,7 @@ function SlideForm({
const [themesOptions, setThemesOptions] = useState();
const [displayPreview, setDisplayPreview] = useState(null);
const [templateError, setTemplateError] = useState(false);
const [disableLivePreview, setDisableLivePreview] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [disableLivePreview, setDisableLivePreview] = useState(false);
const [enablePreview, setEnablePreview] = useState(true);

@@ -401,13 +394,12 @@ function SlideForm({
</Button>
</div>

{selectedTemplate?.resources?.options?.disableLivePreview && (
{disableLivePreview && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{disableLivePreview && (
{enablePreview && (

<Alert variant="secondary" className="mt-3">
{t("slide-preview-disabled-preview")}
</Alert>
)}
{!selectedTemplate?.resources?.options?.disableLivePreview &&
selectedTemplate?.resources?.component && (
{!disableLivePreview && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!disableLivePreview && (
{!enablePreview && (

@@ -92,6 +93,7 @@ function SlideForm({
const [themesOptions, setThemesOptions] = useState();
const [displayPreview, setDisplayPreview] = useState(null);
const [templateError, setTemplateError] = useState(false);
const [disableLivePreview, setDisableLivePreview] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state is never changed in the file......

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :)

Copy link
Contributor

@sinejespersen sinejespersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments, nothing big

@tuj tuj requested a review from sinejespersen August 26, 2025 06:04
@tuj tuj merged commit aff9768 into release/3.0.0 Aug 26, 2025
17 checks passed
@tuj tuj deleted the feature/template-v3 branch August 26, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants