Skip to content

Commit 4bfe451

Browse files
committed
Make header image clickable
1 parent 619b6b4 commit 4bfe451

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/views/public_forms/show.html.erb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<div class="form-content" id="form-content">
5555
<header>
5656
<% if @form.header_image.attached? %>
57-
<%= image_tag url_for(@form.header_image) %>
57+
<%= image_tag url_for(@form.header_image), id: "header-image", style: "cursor: pointer;" %>
5858
<% end %>
5959

6060
<% if @form.header_text.present? %>
@@ -128,6 +128,8 @@
128128
document.addEventListener('DOMContentLoaded', function() {
129129
const introImageContainer = document.getElementById('intro-image-container');
130130
const formContent = document.getElementById('form-content');
131+
const headerImage = document.getElementById('header-image');
132+
const form = document.querySelector('form');
131133

132134
if (introImageContainer) {
133135
introImageContainer.addEventListener('click', function() {
@@ -150,5 +152,11 @@
150152
}, 300);
151153
});
152154
}
155+
156+
if (headerImage && form) {
157+
headerImage.addEventListener('click', function() {
158+
form.submit();
159+
});
160+
}
153161
});
154162
</script>

0 commit comments

Comments
 (0)