|
44 | 44 |
|
45 | 45 | <!-- Help button for how to join --> |
46 | 46 | <div class="help-tooltip-container" style="position: absolute; top: 20px; right: 20px; z-index: 10;"> |
47 | | - <button class="btn-floating white z-depth-2 pulse" id="how-to-join-btn" style="height: 42px; width: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none;" onclick="showHowToJoinModal()"> |
| 47 | + <button class="btn-floating white z-depth-2 pulse modal-trigger" id="how-to-join-btn" style="height: 42px; width: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none;" data-target="how-to-join-modal"> |
48 | 48 | <i class="material-icons <%= @accent_color %>-text">help_outline</i> |
49 | 49 | </button> |
50 | 50 | </div> |
|
353 | 353 | filterLinks[0].style.backgroundColor = '<%= @accent_color == "grey" ? "#9e9e9e" : "var(--#{@accent_color}-lighten-4)" %>'; |
354 | 354 | filterLinks[0].style.fontWeight = '500'; |
355 | 355 |
|
356 | | - // Define the showHowToJoinModal function in global scope |
357 | | - window.showHowToJoinModal = function() { |
358 | | - // Initialize and open the pre-defined modal |
359 | | - var modalElement = document.getElementById('how-to-join-modal'); |
360 | | - var modalInstance = M.Modal.init(modalElement, {opacity: 0.6}); |
361 | | - modalInstance.open(); |
362 | | - }; |
| 356 | + // Initialize all modals |
| 357 | + var modalElems = document.querySelectorAll('.modal'); |
| 358 | + var modalInstances = M.Modal.init(modalElems, {opacity: 0.6}); |
363 | 359 |
|
364 | | - // Initialize the modal when the page loads |
365 | | - var howToJoinModal = document.getElementById('how-to-join-modal'); |
366 | | - M.Modal.init(howToJoinModal, {opacity: 0.6}); |
| 360 | + // Add click handler to the help button |
| 361 | + document.getElementById('how-to-join-btn').addEventListener('click', function() { |
| 362 | + var modalInstance = M.Modal.getInstance(document.getElementById('how-to-join-modal')); |
| 363 | + if (modalInstance) { |
| 364 | + modalInstance.open(); |
| 365 | + } |
| 366 | + }); |
367 | 367 | }); |
368 | 368 | <% end %> |
369 | 369 |
|
|
0 commit comments