fix rsvps + background music

This commit is contained in:
aqua 2025-05-12 15:27:34 -04:00
parent 39cf79222e
commit 610abcdfd6
4 changed files with 31 additions and 36 deletions

View file

@ -4,16 +4,14 @@ class RsvpsController < ApplicationController
if @rsvp.airtable_record_id.blank?
@rsvp.update!(url_params: rsvp_params[:url_params])
end
flash[:success] = "Thanks for your interest! We'll be in touch soon."
redirect_to root_path
redirect_to root_path, flash: { notice: "Thanks for your interest! We'll be in touch soon." }
rescue ActiveRecord::RecordInvalid
flash[:error] = "Please enter a valid email address."
redirect_to root_path
redirect_to root_path, flash: { alert: "Please enter a valid email address." }
end
private
def rsvp_params
params.permit(:email, :url_params)
params.permit(:email, :url_params, :authenticity_token, :commit)
end
end

View file

@ -5,17 +5,9 @@ import "controllers"
import "trix"
import "@rails/actiontext"
function toggleMute() {
var myAudio = document.getElementById('background-audio');
myAudio.muted = !myAudio.muted;
// Update the button icon
var audioToggle = document.getElementById('audio-toggle');
audioToggle.textContent = myAudio.muted ? '🔇' : '🔊';
}
const audio = new Audio('https://hc-cdn.hel1.your-objectstorage.com/s/v3/98df9f1054b50821b1d2208a7d3386a2408134be_d3bd3f0972d62d58cdfce91bc042d32ee643aa94_ui_button_confirm_audio__mp3cut.net__audio.mp4');
audio.volume = 0.75
audio.volume = 0.5
document.addEventListener('click', (event) => {
let el = event.target.closest('a.btn');
if (el) {

View file

@ -1,21 +1,22 @@
<div class="">
<%= form_with url: rsvp_path, method: :post, local: true do |form| %>
<div class="flex flex-col gap-4">
<%= form_with url: rsvp_path, method: :post do |form| %>
<div class="border-4 border-[#544FFF] rounded flex items-center justify-center">
<%= form.text_field :email, placeholder: "Enter your email to join!", class: "landing-input bg-white text-black px-4 py-2 w-3/4 md:w-[300px] flex-grow" %>
<%= form.hidden_field :url_params, value: request.query_string %>
<%= form.submit "→", class: "landing-button bg-[#544FFF] text-white px-4 py-2 font-bold" %>
</div>
<% end %>
<% if flash[:notice] %>
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline"><%= flash[:notice] %></span>
</div>
<% end %>
<% if flash[:alert] %>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline"><%= flash[:alert] %></span>
</div>
<% end %>
</div>
<% if flash[:notice] %>
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline"><%= flash[:notice] %></span>
</div>
<% end %>
<% if flash[:alert] %>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline"><%= flash[:alert] %></span>
</div>
<% end %>

View file

@ -1,16 +1,23 @@
<%# <div class="fixed bottom-0 right-0 z-50 p-4">
<audio id="background-audio" autoplay loop>
<script>
function toggleMute() {
var myAudio = document.getElementById('background-audio');
myAudio.muted = !myAudio.muted;
var audioToggle = document.getElementById('audio-toggle');
audioToggle.textContent = myAudio.muted ? '🔇' : '🔊';
}
</script>
<div class="fixed bottom-0 right-0 z-50 p-4">
<audio id="background-audio" loop autoplay muted>
<source src="/highwaymusic.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<button id="audio-toggle" onclick="toggleMute()" class="bg-[#5453FF] rounded-full p-3 px-4 border-4 border-white text-white">
🔊
🔇
</button>
</div> %>
</div>
<%= image_tag "/bg3.png", class: "absolute w-full h-screen h-full object-cover z-[-1] fixed opacity-20" %>
@ -22,12 +29,9 @@
<div class="relative h-screen flex flex-col items-center justify-center">
<%= image_tag "landing/landinglogo.png", class: "2xl:max-w-5xl xl:max-w-4xl md:max-w-3xl sm:max-w-xl max-w-sm mt-24" %>
<div class="flex flex-col justify-center items-center">
<%= render partial: "emailform" %>
<%= image_tag "/getstickers.gif", style: "width: 200px;", class: "mt-4"%>
<%= link_to "#about", class: "cursor-pointer" do %>
<%= image_tag "/arrows.png", style: "width:50px;", class: "mt-12 animate-bobble" %>
<% end %>