Skip to content

Commit

Permalink
Merge pull request #2016 from cfpb/ans_add_script_decap
Browse files Browse the repository at this point in the history
Add script to decap preview
  • Loading branch information
anselmbradford authored Aug 9, 2024
2 parents afd3b1e + af903c9 commit 42e3474
Show file tree
Hide file tree
Showing 38 changed files with 94 additions and 63 deletions.
9 changes: 5 additions & 4 deletions docs/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : "";
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer", "GTM-WH4L8LB");
})(window, document, 'script', 'dataLayer', 'GTM-WH4L8LB');
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -27,6 +27,7 @@
<body>
<!-- Include the script that builds the page and powers Decap CMS -->
<script src="../dist/admin/decap-cms.js"></script>

<!-- Google Tag Manager code -->
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-WH4L8LB"
Expand Down
15 changes: 15 additions & 0 deletions docs/assets/js/admin/main-preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Script for the main preview pane in the admin.

import {
Expandable,
ExpandableGroup,
Summary,
SummaryMinimal,
Multiselect,
} from '@cfpb/cfpb-design-system';

Summary.init();
SummaryMinimal.init();
ExpandableGroup.init();
Expandable.init();
Multiselect.init();
7 changes: 6 additions & 1 deletion docs/assets/js/admin/widgets/pagePreviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TOGGLE_ATTRIBUTE,
toggleDetails,
} from '../../../../assets/js/toggle-details.js';
import Tabs from '../../../../assets/js/Tabs.js';
import Tabs from '../../../../assets/js/tabs.js';
import { encode } from 'html-entities';
import slugify from 'slugify';
import template from '../../../../_includes/variation-content.html';
Expand All @@ -23,6 +23,11 @@ export default class Preview extends Component {
constructor(props) {
super(props);

const { document } = this.props;
const script = document.createElement('script');
script.src = '../dist/admin/main-preview.js';
document.head.appendChild(script);

liquidEngine.registerFilter('slugify', (initial) =>
slugify(initial || '', { lower: true }),
);
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
MaxHeightTransition,
MoveTransition,
} from '@cfpb/cfpb-design-system';
import Tabs from './Tabs.js';
import Tabs from './tabs.js';
import redirectBanner from './redirect-banner.js';
import sidebar from './sidebar.js';
export * as MainStyles from '../css/main.scss';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions esbuild/docs/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const jsPaths = [
'./docs/assets/js/interstitial.js',
'./docs/assets/js/main.js',
'./docs/assets/js/admin/decap-cms.js',
'./docs/assets/js/admin/main-preview.js',
'./docs/assets/js/search.js',
];

Expand Down
2 changes: 2 additions & 0 deletions packages/cfpb-design-system/dist/abstracts/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/cfpb-design-system/dist/abstracts/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/base/index.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/cfpb-design-system/dist/base/index.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/base/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cfpb-design-system/dist/base/index.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cfpb-design-system/dist/index.css

Large diffs are not rendered by default.

Loading

0 comments on commit 42e3474

Please sign in to comment.