Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for trigger rewrite #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# NPM and Webpack
node_modules
mix.webpack.js
assets/js/app.js.LICENSE.txt

# OS files
.DS_Store
Expand Down
1,467 changes: 1,466 additions & 1 deletion assets/css/theme.css

Large diffs are not rendered by default.

6,150 changes: 6,150 additions & 0 deletions assets/js/app.js

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions assets/js/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import Snowboard from '../../../../../modules/system/assets/js/snowboard/main/Snowboard';
import ProxyHandler from '../../../../../modules/system/assets/js/snowboard/main/ProxyHandler';
import Request from '../../../../../modules/system/assets/js/snowboard/ajax/Request';
import AttributeRequest from '../../../../../modules/system/assets/js/snowboard/ajax/handlers/AttributeRequest';
import AssetLoader from '../../../../../modules/system/assets/js/snowboard/extras/AssetLoader';
import DataConfig from '../../../../../modules/system/assets/js/snowboard/extras/DataConfig';
import StylesheetLoader from '../../../../../modules/system/assets/js/snowboard/extras/StylesheetLoader';
import Transition from '../../../../../modules/system/assets/js/snowboard/extras/Transition';
import Flash from '../../../../../modules/system/assets/js/snowboard/extras/Flash';
import FlashListener from '../../../../../modules/system/assets/js/snowboard/extras/FlashListener';
import FormValidation from '../../../../../modules/system/assets/js/snowboard/extras/FormValidation';
import AttachLoading from '../../../../../modules/system/assets/js/snowboard/extras/AttachLoading';
import StripeLoader from '../../../../../modules/system/assets/js/snowboard/extras/StripeLoader';
import Trigger from '../../../../../modules/system/assets/js/snowboard/extras/Trigger';

((window) => {
const snowboard = new Proxy(
new Snowboard(true, true),
ProxyHandler,
);

// Cover all aliases
window.snowboard = snowboard;
window.Snowboard = snowboard;
window.SnowBoard = snowboard;

snowboard.addPlugin('request', Request);
snowboard.addPlugin('attributeRequest', AttributeRequest);
snowboard.addPlugin('assetLoader', AssetLoader);
snowboard.addPlugin('dataConfig', DataConfig);
snowboard.addPlugin('extrasStyles', StylesheetLoader);
snowboard.addPlugin('transition', Transition);
snowboard.addPlugin('flash', Flash);
snowboard.addPlugin('flashListener', FlashListener);
snowboard.addPlugin('formValidation', FormValidation);
snowboard.addPlugin('attachLoading', AttachLoading);
snowboard.addPlugin('stripeLoader', StripeLoader);
snowboard.addPlugin('trigger', Trigger);

snowboard.on('ready', () => {
// Scan for triggers
Array
.from(document.querySelectorAll('*'))
.filter((element) => [...element.attributes].filter(
({ name }) => name.startsWith("data-trigger-")).length > 0
).forEach((element) => {
snowboard.trigger(element);
});
});
})(window);
2 changes: 1 addition & 1 deletion pages/blog/category.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'blog/category-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/blog/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'blog/category-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/blog/post.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-3/4">
<div class="flex-grow-0 px-8 lg:w-3/4">
{{ post.content | md }}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/cms/icons.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'cms/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/cms/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'cms/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/cms/layout-component.htm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'cms/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/snowboard/attr-requests.htm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'snowboard/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/snowboard/extras.htm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'snowboard/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/snowboard/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'snowboard/sections-list' %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/snowboard/js-requests.htm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<section id="body" class="py-20 flex-grow">
<div class="container max-w-screen-xl">
<div class="block lg:flex lg:flex-row divide-x divide-gray-100">
<div class="flew-grow-0 px-8 lg:w-2/12 xl:pr-0">
<div class="flex-grow-0 px-8 lg:w-2/12 xl:pr-0">
{% partial 'snowboard/sections-list' %}
</div>

Expand Down
Loading