Skip to content

Commit 46f420a

Browse files
drusepthclaude
andcommitted
Fix non-functioning help button for ArtFight2025 page
- Replaced link with proper clickable button element - Added inline onclick handler for immediate response - Pre-defined modal structure in HTML instead of generating it dynamically - Simplified JavaScript modal initialization for reliability - Fixed event handling to ensure proper click response 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ca99db5 commit 46f420a

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

app/views/browse/tag.html.erb

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<!-- Modal structure - defined before the content so it's available immediately -->
2+
<div id="how-to-join-modal" class="modal modal-how-to-join">
3+
<div class="modal-content">
4+
<h4><i class="material-icons <%= @accent_color %>-text left" style="margin-right: 10px;">info</i> How to join this showcase</h4>
5+
<p>Want your content to appear on this page? Follow these steps:</p>
6+
<ol>
7+
<li>Add the <span class="highlight">ArtFight2025</span> tag to your content</li>
8+
<li>Set your content's privacy to <span class="highlight">Public</span> in the privacy toggle</li>
9+
<li>That's it! Your content will appear here automatically</li>
10+
</ol>
11+
<p class="grey-text" style="font-size: 14px;">Note: It may take a few minutes for new content to appear.</p>
12+
</div>
13+
<div class="modal-footer">
14+
<a href="#!" class="modal-close waves-effect waves-light <%= @accent_color %> btn-flat white-text">Got it</a>
15+
</div>
16+
</div>
17+
118
<div class="row">
219
<!-- Privacy text in top right -->
320
<div class="col s12">
@@ -27,9 +44,9 @@
2744

2845
<!-- Help button for how to join -->
2946
<div class="help-tooltip-container" style="position: absolute; top: 20px; right: 20px; z-index: 10;">
30-
<a 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;">
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()">
3148
<i class="material-icons <%= @accent_color %>-text">help_outline</i>
32-
</a>
49+
</button>
3350
</div>
3451

3552
<!-- Art Fight 2025 header info -->
@@ -336,37 +353,17 @@
336353
filterLinks[0].style.backgroundColor = '<%= @accent_color == "grey" ? "#9e9e9e" : "var(--#{@accent_color}-lighten-4)" %>';
337354
filterLinks[0].style.fontWeight = '500';
338355

339-
// How to join modal
340-
document.getElementById('how-to-join-btn').addEventListener('click', function() {
341-
// Show modal
342-
var modalHtml = `
343-
<div id="how-to-join-modal" class="modal modal-how-to-join">
344-
<div class="modal-content">
345-
<h4><i class="material-icons <%= @accent_color %>-text left" style="margin-right: 10px;">info</i> How to join this showcase</h4>
346-
<p>Want your content to appear on this page? Follow these steps:</p>
347-
<ol>
348-
<li>Add the <span class="highlight">ArtFight2025</span> tag to your content</li>
349-
<li>Set your content's privacy to <span class="highlight">Public</span> in the privacy toggle</li>
350-
<li>That's it! Your content will appear here automatically</li>
351-
</ol>
352-
<p class="grey-text" style="font-size: 14px;">Note: It may take a few minutes for new content to appear.</p>
353-
</div>
354-
<div class="modal-footer">
355-
<a href="#!" class="modal-close waves-effect waves-light <%= @accent_color %> btn-flat white-text">Got it</a>
356-
</div>
357-
</div>
358-
`;
359-
360-
// Add modal to DOM if it doesn't exist
361-
if (!document.getElementById('how-to-join-modal')) {
362-
document.body.insertAdjacentHTML('beforeend', modalHtml);
363-
}
364-
365-
// Initialize and open modal
356+
// Define the showHowToJoinModal function in global scope
357+
window.showHowToJoinModal = function() {
358+
// Initialize and open the pre-defined modal
366359
var modalElement = document.getElementById('how-to-join-modal');
367360
var modalInstance = M.Modal.init(modalElement, {opacity: 0.6});
368361
modalInstance.open();
369-
});
362+
};
363+
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});
370367
});
371368
<% end %>
372369

0 commit comments

Comments
 (0)