Skip to content

Commit

Permalink
Timebased Trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
derB4 committed Sep 20, 2024
1 parent aa2cbd9 commit 0166223
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 25 deletions.
6 changes: 4 additions & 2 deletions templates/landingpage/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = cx.design
/*.withLabel('Content')*/
.withLabel('Inhalt')
.withContentElements(
require('@bsi-cx/design-standard-library-web/content-elements/base/text').editor(require('../shared/configs/editor/formatted-text-editor')),
require('@bsi-cx/design-standard-library-web/content-elements/base/text'),
require('@bsi-cx/design-standard-library-web/content-elements/base/figure'),
require('@bsi-cx/design-standard-library-web/content-elements/base/banner'),
require('@bsi-cx/design-standard-library-web/content-elements/base/button'),
Expand All @@ -53,7 +53,9 @@ module.exports = cx.design
require('@bsi-cx/design-standard-library-web/content-elements/advanced/webcam-image-upload'),
require('@bsi-cx/design-standard-library-web/content-elements/base/slot-finder'),
require('@bsi-cx/design-standard-library-web/content-elements/base/chart'),
require('@bsi-cx/design-standard-library-web/content-elements/base/html')),
require('@bsi-cx/design-standard-library-web/content-elements/base/html'),
require('../shared/content-elements/timebased-trigger'),
),
cx.contentElementGroup
.withGroupId('forms-NjbmnQ')
/*.withLabel('Forms')*/
Expand Down
4 changes: 3 additions & 1 deletion templates/landingpage/modules/main.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import '@bsi-cx/design-standard-library-web/core/main/index';
import '../../shared/modules';

import '@bsi-cx/design-standard-library-web/core/main/index';
2 changes: 1 addition & 1 deletion templates/landingpage/preview.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block content %}
{% include '@bsi-cx/design-standard-library-web/content-elements/advanced/webcam-image-upload/template.twig' %}

{% include "../shared/content-elements/timebased-trigger/template.twig" %}
{% embed '@bsi-cx/design-standard-library-web/content-elements/layout/col-two/template.twig' %}
{% block col_two_dropzone_1 %}

Expand Down
13 changes: 13 additions & 0 deletions templates/shared/content-elements/timebased-trigger/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { cx, Icon } = require("@bsi-cx/design-build");

module.exports = cx.contentElement
.withFile(require("./template.twig"))
.withElementId("timebased-trigger-mO9Z1B")
.withLabel("Zeitgesteuerter Link")
.withIcon(Icon.ASTERISK)
.withParts(
cx.part.plainText
.withId("delay-wnR8CR")
.withLabel("Ausführung nach (in ms)"),
cx.part.link.withId("link-NOxBEU").withLabel("Link")
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div data-bsi-element="timebased-trigger-mO9Z1B" class="d-none" x-data="timebasedTrigger">
<div data-bsi-element-part="delay-wnR8CR" class="delay">3000</div>
<a href="https://www.bsi-software.com" data-bsi-element-part="link-NOxBEU" data-bsi-link-fixed-inner-html></a>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Alpine from "@alpinejs/csp";

Alpine.data("timebasedTrigger", () => ({
init() {
var delay = Number(this.$root.querySelector(".delay").innerText);
var linkElement = this.$root.querySelector("a");
if (delay && linkElement) {
setTimeout(() => {
linkElement.click();
}, delay);
}
},
}));
1 change: 1 addition & 0 deletions templates/shared/modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../content-elements/timebased-trigger/timebasedTrigger';
6 changes: 4 additions & 2 deletions templates/website/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = cx.design
/*.withLabel('Content')*/
.withLabel('Inhalt')
.withContentElements(
require('@bsi-cx/design-standard-library-web/content-elements/base/text').editor(require('../shared/configs/editor/formatted-text-editor')),
require('@bsi-cx/design-standard-library-web/content-elements/base/text'),
require('@bsi-cx/design-standard-library-web/content-elements/base/figure'),
require('@bsi-cx/design-standard-library-web/content-elements/base/banner'),
require('@bsi-cx/design-standard-library-web/content-elements/base/button'),
Expand All @@ -53,7 +53,9 @@ module.exports = cx.design
require('@bsi-cx/design-standard-library-web/content-elements/advanced/webcam-image-upload'),
require('@bsi-cx/design-standard-library-web/content-elements/base/slot-finder'),
require('@bsi-cx/design-standard-library-web/content-elements/base/chart'),
require('@bsi-cx/design-standard-library-web/content-elements/base/html')),
require('@bsi-cx/design-standard-library-web/content-elements/base/html'),
require('../shared/content-elements/timebased-trigger'),
),
cx.contentElementGroup
.withGroupId('forms-NjbmnQ')
/*.withLabel('Forms')*/
Expand Down
38 changes: 19 additions & 19 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const package = require('./package.json');
const {BuildConfig, WebpackConfigBuilder, Version, DesignType, ModuleConfig} = require('@bsi-cx/design-build');

const landingpageBuildConfig = new BuildConfig()
.withName('master-template-cx-22.0-landingpage')
.withName('bsi-elements-cx-22.0-landingpage')
.withVersion(package.version)
.withDesignType(DesignType.LANDINGPAGE)
.withTargetVersion(Version.CX_22_0)
Expand All @@ -23,7 +23,7 @@ const landingpageBuildConfig = new BuildConfig()


const websiteBuildConfig = new BuildConfig()
.withName('master-template-cx-22.0-website')
.withName('bsi-elements-cx-22.0-website')
.withVersion(package.version)
.withDesignType(DesignType.WEBSITE)
.withTargetVersion(Version.CX_22_0)
Expand All @@ -41,28 +41,28 @@ const websiteBuildConfig = new BuildConfig()
});

module.exports = WebpackConfigBuilder.fromConfigs(
// websiteBuildConfig.clone()
// .withName('bsi-elements-cx-1.3-website')
// .withTargetVersion(Version.CX_1_3)
// .withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
// websiteBuildConfig.clone()
// .withName('bsi-elements-cx-22.0-website')
// .withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
websiteBuildConfig.clone()
.withName('master-template-cx-1.3-website')
.withTargetVersion(Version.CX_1_3)
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
websiteBuildConfig.clone()
.withName('master-template-cx-22.0-website')
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
websiteBuildConfig.clone()
.withName('master-template-cx-23.2-website')
.withName('bsi-elements-cx-23.2-website')
.withTargetVersion(Version.CX_23_2)
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
// landingpageBuildConfig.clone()
// .withName('bsi-elements-cx-1.3-landingpage-de')
// .withTargetVersion(Version.CX_1_3)
// .withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
// landingpageBuildConfig.clone()
// .withName('bsi-elements-cx-22.0-landingpage-de')
// .withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
landingpageBuildConfig.clone()
.withName('master-template-cx-1.3-landingpage-de')
.withTargetVersion(Version.CX_1_3)
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
landingpageBuildConfig.clone()
.withName('master-template-cx-22.0-landingpage-de')
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js')),
landingpageBuildConfig.clone()
.withName('master-template-cx-23.2-landingpage-de')
.withName('bsi-elements-cx-23.2-landingpage-de')
.withTargetVersion(Version.CX_23_2)
.withPropertiesFilePath(path.resolve(__dirname, 'properties-de.js'))
/*landingpageBuildConfig.clone()
.withName('master-template-cx-22.0-landingpage-en')
.withName('bsi-elements-cx-22.0-landingpage-en')
.withPropertiesFilePath(path.resolve(__dirname, 'properties-en.js'))*/);

0 comments on commit 0166223

Please sign in to comment.