|
3 | 3 | its styles live in assets/scss/_event-landing.scss, scoped under |
4 | 4 | .dmd-landing (and every class prefixed dmd-) so nothing leaks into the rest |
5 | 5 | of the site. Text, speakers and the schedule come from the page's front |
6 | | - matter. While registration_url is empty, every Register button opens the |
7 | | - "coming soon" dialog; set it and they become plain links. |
| 6 | + matter. Every Register button opens a pop-up with the registration widget |
| 7 | + (registration_widget in front matter, loaded on first open). Without a |
| 8 | + widget, registration_url turns them into plain links, and without that they |
| 9 | + open a "coming soon" dialog. |
8 | 10 | */}} |
9 | 11 | {{ define "main" }} |
10 | 12 | {{ $reg := .Params.registration_url }} |
| 13 | +{{ if .Params.registration_widget }}{{ $reg = "" }}{{ end }} |
11 | 14 | {{ $page := . }} |
12 | 15 | <div class="dmd-landing"> |
13 | 16 |
|
@@ -99,7 +102,34 @@ <h1>DuckDB <span class="dmd-cross">×</span><br>MySQL <span class="dmd-gradient" |
99 | 102 | </div> |
100 | 103 | </section> |
101 | 104 |
|
102 | | - {{ if not $reg }} |
| 105 | + {{ $widget := .Params.registration_widget }} |
| 106 | + {{ if $widget }} |
| 107 | + <dialog id="registration" class="dmd-dialog-widget" aria-label="Register for {{ .Title }}"> |
| 108 | + <button class="dmd-close" aria-label="Close registration form">×</button> |
| 109 | + <div class="dmd-hopin-container" id="registration-widget" data-src="{{ $widget }}"></div> |
| 110 | + </dialog> |
| 111 | + <script> |
| 112 | + (function () { |
| 113 | + var dialog = document.getElementById('registration'); |
| 114 | + var box = document.getElementById('registration-widget'); |
| 115 | + if (!dialog || !dialog.showModal) return; |
| 116 | + function load() { |
| 117 | + if (box.firstChild) return; |
| 118 | + // Load the registration form on first open only, and pass any query |
| 119 | + // string (e.g. UTM tags) through to it. |
| 120 | + var iframe = document.createElement('iframe'); |
| 121 | + iframe.src = box.getAttribute('data-src') + window.location.search.replace('?', '&'); |
| 122 | + iframe.title = 'Registration form'; |
| 123 | + box.appendChild(iframe); |
| 124 | + } |
| 125 | + document.querySelectorAll('[data-register]').forEach(function (b) { |
| 126 | + b.addEventListener('click', function () { load(); dialog.showModal(); }); |
| 127 | + }); |
| 128 | + dialog.querySelector('.dmd-close').addEventListener('click', function () { dialog.close(); }); |
| 129 | + dialog.addEventListener('click', function (e) { if (e.target === dialog) dialog.close(); }); |
| 130 | + })(); |
| 131 | + </script> |
| 132 | + {{ else if not $reg }} |
103 | 133 | <dialog id="registration"> |
104 | 134 | <button class="dmd-close" aria-label="Close registration information">×</button> |
105 | 135 | <p class="dmd-eyebrow">DUCKDB × MYSQL DAY</p> |
|
0 commit comments