From 483a371ebd20035e70bafd99b3e04067b2da184b Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Sat, 20 Dec 2025 00:14:34 +0000 Subject: [PATCH 1/9] Improve application layouts! --- .../layouts/_shared_body_suffix.html.erb | 42 +++ app/views/layouts/_shared_head.html.erb | 71 +++++ app/views/layouts/_shared_seasonal.html.erb | 10 + app/views/layouts/admin.html.erb | 18 +- app/views/layouts/application.html.erb | 246 +++++------------- app/views/layouts/docs.html.erb | 102 +------- app/views/layouts/login.html.erb | 70 +---- 7 files changed, 202 insertions(+), 357 deletions(-) create mode 100644 app/views/layouts/_shared_body_suffix.html.erb create mode 100644 app/views/layouts/_shared_head.html.erb create mode 100644 app/views/layouts/_shared_seasonal.html.erb diff --git a/app/views/layouts/_shared_body_suffix.html.erb b/app/views/layouts/_shared_body_suffix.html.erb new file mode 100644 index 0000000000..06e1fd7b82 --- /dev/null +++ b/app/views/layouts/_shared_body_suffix.html.erb @@ -0,0 +1,42 @@ +<% if Rails.env.production? && !local_assigns[:skip_fullstory] %> + <%= render "application/fullstory" if current_user&.sessions_reported %> +<% end %> + +<% if flash[:confetti] %> + + +<% end %> +<% if Flipper.enabled?(:transactions_background_2024_06_05, current_user) %> + +<% end %> diff --git a/app/views/layouts/_shared_head.html.erb b/app/views/layouts/_shared_head.html.erb new file mode 100644 index 0000000000..5c17d4995a --- /dev/null +++ b/app/views/layouts/_shared_head.html.erb @@ -0,0 +1,71 @@ + + <%= yield(:title).concat(" –") if content_for?(:title) %> + <%= local_assigns[:title_suffix] || "HCB" %> + +<%= csrf_meta_tags %> +<%= csp_meta_tag %> +"> + +<%= yield(:before_assets) if content_for?(:before_assets) %> + +<%= javascript_include_tag "dark", 'data-turbo-track': "reload" unless local_assigns[:skip_dark_js] %> +<%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" unless local_assigns[:custom_stylesheet] %> +<%= yield(:custom_stylesheet) if content_for?(:custom_stylesheet) %> +<%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true unless local_assigns[:custom_application_js] %> +<%= yield(:custom_application_js) if content_for?(:custom_application_js) %> +<%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> + +<%= yield(:additional_scripts) if content_for?(:additional_scripts) %> + +<% if Rails.env.production? && !local_assigns[:skip_plausible] %> + +<% end %> + +<% unless Rails.env.production? %> + +<% end %> + +<% if Rails.env.production? && !local_assigns[:skip_console_art] %> + +<% end %> + + + +<% if content_for?(:favicon) %> + <%= yield :favicon %> +<% elsif user_birthday? %> + +<% else %> + + +<% end %> + + + + +<%= yield(:additional_head_tags) if content_for?(:additional_head_tags) %> +<%= yield(:head) if content_for?(:head) %> diff --git a/app/views/layouts/_shared_seasonal.html.erb b/app/views/layouts/_shared_seasonal.html.erb new file mode 100644 index 0000000000..c3978f8d5b --- /dev/null +++ b/app/views/layouts/_shared_seasonal.html.erb @@ -0,0 +1,10 @@ +<%# LET THERE BE SNOW %> +<% if winter? %> + <%= react_component "holiday/Snow", {}, { style: local_assigns[:snow_style] || "height:100%" } %> +<% end %> + +<%# ghosts and ghouls %> +<% if fall? %> + oOoOoOoOo + witch orpheus +<% end %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 3454f028a4..5957770461 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -3,21 +3,15 @@ - - <%= "#{yield(:title)} –" if content_for?(:title) %> - HCB Admin - + <%= render "layouts/shared_head", + title_suffix: "HCB Admin", + custom_stylesheet: true, + custom_application_js: true, + skip_console_art: true, + skip_plausible: true %> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= javascript_include_tag "dark", 'data-turbo-track': "reload" %> <%= stylesheet_link_tag "admin", media: "all", "data-turbo-track": "reload" %> <%= javascript_include_tag "admin", "data-turbo-track": "reload", defer: true %> - <%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> - - - - <%= yield(:head) if content_for?(:head) %> Skip to main content diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a152bcbb6c..03c49410bc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,76 +4,14 @@ - - <%= yield(:title).concat(" –") if content_for?(:title) %> - HCB - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - "> - - <%= javascript_include_tag "dark", 'data-turbo-track': "reload" %> - <%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" %> - <%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true %> - <%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> + <%= render "layouts/shared_head" %> <%# Web component used for TOTP / donation QR codes %> - <% if Rails.env.production? %> - - <% end %> - <%= render "application/helpscout_beacon" %> - <% unless Rails.env.production? %> - - <% end %> - - <% if Rails.env.production? %> - - <% end %> - - - - <% if content_for?(:favicon) %> - <%= yield :favicon %> - <% elsif user_birthday? %> - - <% else %> - - - <% end %> - - - - - <%= yield(:head) if content_for?(:head) %> class="bg-snow embedded <%= content_for :page_class %> <%= "season-#{current_season}" if current_season %>">
@@ -84,124 +22,74 @@ options: @tour&.tourable&.try(:tourable_options) || {}, back_to_tour: @back_to_tour %> -<%# LET THERE BE SNOW %> -<% if winter? %> - <%= react_component "holiday/Snow", {}, { style: "height:100%" } %> -<% end %> - -<%# ghosts and ghouls %> -<% if fall? %> - oOoOoOoOo - witch orpheus -<% end %> - -<% if content_for?(:nav) %> -
- <% if @event && @first_time %> -
-
-
- <%= image_tag "logo-production-dark.svg", width: 100, class: "logo-dark" %> - <%= image_tag "logo-production.svg", width: 100, class: "logo" %> -
-
- -
- No thanks, bring me straight to HCB -
- <% end %> - - <%= render "application/native_changelog" if @latest_changelog_post %> - <%= render "application/the_bin" if @the_bin %> - - - - <%= yield(:mobile_nav) %> -
+ <%= render "layouts/shared_seasonal" %> + + <% if content_for?(:nav) %> +
+ <% if @event && @first_time %> +
+
+
+ <%= image_tag "logo-production-dark.svg", width: 100, class: "logo-dark" %> + <%= image_tag "logo-production.svg", width: 100, class: "logo" %> +
+
+ +
+ No thanks, bring me straight to HCB +
+ <% end %> + + <%= render "application/native_changelog" if @latest_changelog_post %> + <%= render "application/the_bin" if @the_bin %> + + + + <%= yield(:mobile_nav) %> +
+ <%= render "application/banner_container" %> +
+
+ <%= render "application/flash" unless @hide_flash %> +
+ <%= yield(:container) %> + <%= yield %> + <%= render "application/footer" unless @no_app_shell || @hide_footer %> +
+
+
+ <% else %> <%= render "application/banner_container" %> -
-
- <%= render "application/flash" unless @hide_flash %> + <% unless @no_app_shell %> +
+ <%= render "application/logo" %>
- <%= yield(:container) %> + <% end %> + <%= yield(:header) %> +
+ <%= render "application/flash" unless @hide_flash %> <%= yield %> - <%= render "application/footer" unless @no_app_shell || @hide_footer %> -
-
-
-<% else %> - <%= render "application/banner_container" %> - <% unless @no_app_shell %> -
- <%= render "application/logo" %> -
- <% end %> - <%= yield(:header) %> -
- <%= render "application/flash" unless @hide_flash %> - <%= yield %> -
-<% end %> - -<% if Rails.env.production? %> - <%= render "application/fullstory" if current_user&.sessions_reported %> -<% end %> - -<% if flash[:confetti] %> - - -<% end %> -<% if Flipper.enabled?(:transactions_background_2024_06_05, current_user) %> - -<% end %> - + <%= render "layouts/shared_body_suffix" %> + diff --git a/app/views/layouts/docs.html.erb b/app/views/layouts/docs.html.erb index 0d3b2be3ee..2e8a814526 100644 --- a/app/views/layouts/docs.html.erb +++ b/app/views/layouts/docs.html.erb @@ -4,69 +4,10 @@ - - <%= yield(:title).concat(" –") if content_for?(:title) %> - HCB - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - "> - - <%= javascript_include_tag "dark", 'data-turbo-track': "reload" %> - <%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" %> - <%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> - <%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true %> + <%= render "layouts/shared_head", console_art_url: Rails.configuration.constants.hack_on_hcb_form_url %> <%# Web component used for TOTP / donation QR codes %> - - <% unless Rails.env.production? %> - - <% end %> - - <% if Rails.env.production? %> - - <% end %> - - - - <% if content_for?(:favicon) %> - <%= yield :favicon %> - <% elsif user_birthday? %> - - <% else %> - - - <% end %> - - - - - <%= yield(:head) if content_for?(:head) %> class="bg-snow embedded <%= content_for :page_class %> <%= "season-#{current_season}" if current_season %>"> <%= react_component "tour/TourOverlay", @@ -87,21 +28,12 @@

This HCB organization has made their finances public. - Hey, <%= link_to "what’s HCB?", "https://hackclub.com/fiscal-sponsorship/", target: "_blank", class: "primary" %> + Hey, <%= link_to "what's HCB?", "https://hackclub.com/fiscal-sponsorship/", target: "_blank", class: "primary" %>

<% end %> - <%# LET THERE BE SNOW %> - <% if winter? %> - <%= react_component "holiday/Snow", {}, { style: "height:100%" } %> - <% end %> - - <%# ghosts and ghouls %> - <% if fall? %> - oOoOoOoOo - witch orpheus - <% end %> + <%= render "layouts/shared_seasonal" %> <% if content_for?(:nav) %>
@@ -151,32 +83,6 @@ <% end %> <%= render "application/fullstory" %> - - <% if flash[:confetti] %> - - - <% end %> - <% if Flipper.enabled?(:transactions_background_2024_06_05, current_user) %> - - <% end %> + <%= render "layouts/shared_body_suffix" %> diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index e8c7b20640..6a6ef81aae 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -5,64 +5,7 @@ - - <%= yield(:title).concat(" –") if content_for?(:title) %> - HCB - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - "> - <%= javascript_include_tag "dark", 'data-turbo-track': "reload" %> - <%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" %> - <%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true %> - <%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> - <% if Rails.env.production? %> - - <% end %> - <% unless Rails.env.production? %> - - <% end %> - <% if Rails.env.production? %> - - <% end %> - - - <% if content_for?(:favicon) %> - <%= yield :favicon %> - <% elsif user_birthday? %> - - <% else %> - - - <% end %> - - - - + <%= render "layouts/shared_head" %> - <%= yield(:head) if content_for?(:head) %> <% img = "/brand/hcb-icon-icon-original.png" %> @@ -93,15 +35,7 @@ class="bg-snow embedded <%= content_for :page_class %> <%= "season-#{current_season}" if current_season %>"> - <%# LET THERE BE SNOW %> - <% if winter? %> - <%= react_component "holiday/Snow", {}, { style: "height:0px" } %> - <% end %> - <%# ghosts and ghouls %> - <% if fall? %> - oOoOoOoOo - witch orpheus - <% end %> + <%= render "layouts/shared_seasonal", snow_style: "height:0px" %> <%= yield(:header) %>
From 778e91196c69c92a6878f2877dd4c3e33e67678d Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Sat, 20 Dec 2025 00:18:59 +0000 Subject: [PATCH 2/9] Improve head code --- app/views/layouts/_shared_head.html.erb | 3 +++ app/views/layouts/admin.html.erb | 2 -- app/views/layouts/application.html.erb | 3 --- app/views/layouts/docs.html.erb | 2 -- app/views/layouts/login.html.erb | 3 --- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app/views/layouts/_shared_head.html.erb b/app/views/layouts/_shared_head.html.erb index 5c17d4995a..aedd4eb6a4 100644 --- a/app/views/layouts/_shared_head.html.erb +++ b/app/views/layouts/_shared_head.html.erb @@ -1,3 +1,6 @@ +<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> + + <%= yield(:title).concat(" –") if content_for?(:title) %> <%= local_assigns[:title_suffix] || "HCB" %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 5957770461..703d62d6fc 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -1,5 +1,3 @@ -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> - <!DOCTYPE html> <html lang="en" data-dark="<%= @is_dark %>"> <head> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 03c49410bc..6de5c94704 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,8 +1,5 @@ -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> - <!DOCTYPE html> <html lang="en" data-dark="<%= @is_dark %>"> - <!-- come hack with us on hcb! <%= Rails.configuration.constants.github_url %> --> <head> <%= render "layouts/shared_head" %> diff --git a/app/views/layouts/docs.html.erb b/app/views/layouts/docs.html.erb index 2e8a814526..f9039ecebc 100644 --- a/app/views/layouts/docs.html.erb +++ b/app/views/layouts/docs.html.erb @@ -1,5 +1,3 @@ -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> - <!DOCTYPE html> <html lang="en" data-dark="<%= @is_dark %>"> <!-- come hack with us on hcb! <%= Rails.configuration.constants.hack_on_hcb_form_url %> --> diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index 6a6ef81aae..e9cdbe00b7 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -1,9 +1,7 @@ -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> <% @home_size = 50 %> <% page_full %> <!DOCTYPE html> <html lang="en" data-dark="<%= @is_dark %>" class="overscroll-none"> - <!-- come hack with us on hcb! <%= Rails.configuration.constants.github_url %> --> <head> <%= render "layouts/shared_head" %> <style> @@ -13,7 +11,6 @@ } @media (min-width: 640px) { - html, body { height: 100vh; From df5ea6437969089d28061c3bb4abfb4fab1c44fd Mon Sep 17 00:00:00 2001 From: Manu Gurudath <manusvathgurudath@gmail.com> Date: Sat, 20 Dec 2025 00:20:18 +0000 Subject: [PATCH 3/9] Remove more duplicate code --- app/views/layouts/_shared_head.html.erb | 1 + app/views/layouts/application.html.erb | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/layouts/_shared_head.html.erb b/app/views/layouts/_shared_head.html.erb index aedd4eb6a4..5f419698bc 100644 --- a/app/views/layouts/_shared_head.html.erb +++ b/app/views/layouts/_shared_head.html.erb @@ -8,6 +8,7 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> <meta name="theme-color" content="<%= @is_dark ? "#17171d" : "#f9fafc" %>"> +<meta name="apple-itunes-app" content="app-id=6465424810"> <%= yield(:before_assets) if content_for?(:before_assets) %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6de5c94704..587b0185fe 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,13 +2,9 @@ <html lang="en" data-dark="<%= @is_dark %>"> <head> <%= render "layouts/shared_head" %> - <%# Web component used for TOTP / donation QR codes %> <script src="https://unpkg.com/@bitjson/qr-code@1.0.2/dist/qr-code.js"></script> - <%= render "application/helpscout_beacon" %> - - <meta name="apple-itunes-app" content="app-id=6465424810"> </head> <body <%= yield(:body_attributes) if content_for?(:body_attributes) %> class="bg-snow embedded <%= content_for :page_class %> <%= "season-#{current_season}" if current_season %>"> <div id="tooltip-container"></div> From 2f02b51ff2280e787f98298dc4f10f7e6ead5a3e Mon Sep 17 00:00:00 2001 From: Manu Gurudath <manusvathgurudath@gmail.com> Date: Sat, 20 Dec 2025 20:59:01 +0000 Subject: [PATCH 4/9] improve code based on @Luke-Oldenburg's feedback --- .../api/v4/transactions_controller.rb | 19 ++++- app/mailers/contract/party_mailer.rb | 2 +- app/models/contract.rb | 4 +- app/models/contract/party.rb | 8 ++ .../transactions/_transaction.json.jbuilder | 2 +- .../contract/party_mailer/notify_hcb.html.erb | 6 +- app/views/layouts/_body_suffix.html.erb | 43 +++++++++++ app/views/layouts/_head.html.erb | 76 +++++++++++++++++++ app/views/layouts/_seasonal.html.erb | 11 +++ app/views/layouts/admin.html.erb | 2 +- app/views/layouts/application.html.erb | 6 +- app/views/layouts/docs.html.erb | 6 +- app/views/layouts/login.html.erb | 4 +- app/views/static_pages/index.html.erb | 5 +- config/routes.rb | 6 +- 15 files changed, 180 insertions(+), 20 deletions(-) create mode 100644 app/views/layouts/_body_suffix.html.erb create mode 100644 app/views/layouts/_head.html.erb create mode 100644 app/views/layouts/_seasonal.html.erb diff --git a/app/controllers/api/v4/transactions_controller.rb b/app/controllers/api/v4/transactions_controller.rb index ef21e0e6d5..7952f9c9cb 100644 --- a/app/controllers/api/v4/transactions_controller.rb +++ b/app/controllers/api/v4/transactions_controller.rb @@ -51,9 +51,11 @@ def show def missing_receipt user_hcb_code_ids = current_user.stripe_cards.flat_map { |card| card.local_hcb_codes.pluck(:id) } - user_hcb_codes = HcbCode.where(id: user_hcb_code_ids) + user_hcb_codes = HcbCode.where(id: user_hcb_code_ids).includes(:events) + hcb_codes_missing_ids = user_hcb_codes.select do |hcb_code| + hcb_code.events.any? { |event| hcb_code.missing_receipt?(event) } + end.map(&:id) - hcb_codes_missing_ids = user_hcb_codes.missing_receipt.receipt_required.pluck(:id) @hcb_codes = HcbCode.where(id: hcb_codes_missing_ids).order(created_at: :desc) @total_count = @hcb_codes.size @@ -77,6 +79,19 @@ def memo_suggestions @suggested_memos = ::HcbCodeService::SuggestedMemos.new(hcb_code: @hcb_code, event: @event).run.first(4) end + def mark_no_receipt + @hcb_code = HcbCode.find_by_public_id!(params[:id]) + authorize @hcb_code, :mark_no_or_lost?, policy_class: ReceiptablePolicy + + begin + @hcb_code.no_or_lost_receipt! + rescue + return render json: { error: "invalid_operation", messages: "Failed to mark transaction as no/lost receipt" }, status: :unprocessable_entity + end + + render json: { message: "Transaction marked as no/lost receipt" }, status: :ok + end + private def paginate_transactions(transactions) diff --git a/app/mailers/contract/party_mailer.rb b/app/mailers/contract/party_mailer.rb index 93159b611a..6b7dbf6f41 100644 --- a/app/mailers/contract/party_mailer.rb +++ b/app/mailers/contract/party_mailer.rb @@ -7,7 +7,7 @@ def notify @contract = @party.contract mail to: @party.email, - subject: "You've been invited to sign an agreement for #{@contract.event.name} on HCB 📝", + subject: @party.notify_email_subject, template_name: "notify_#{@party.role}" end diff --git a/app/models/contract.rb b/app/models/contract.rb index 3c7cedd055..b76ddf798d 100644 --- a/app/models/contract.rb +++ b/app/models/contract.rb @@ -71,7 +71,7 @@ class Contract < ApplicationRecord event :mark_sent do transitions from: :pending, to: :sent after do - parties.each(&:notify) + parties.not_hcb.each(&:notify) end end @@ -138,6 +138,8 @@ def party(role) def on_party_signed if parties.all?(&:signed?) mark_signed! + elsif parties.not_hcb.all?(&:signed?) + party(:hcb).notify end end diff --git a/app/models/contract/party.rb b/app/models/contract/party.rb index 57d1a4c6f0..c68c5af252 100644 --- a/app/models/contract/party.rb +++ b/app/models/contract/party.rb @@ -81,6 +81,14 @@ def docuseal_role end end + def notify_email_subject + if hcb? + "Sign the #{contract.event.name}'s agreement as HCB Operations" + else + "You've been invited to sign an agreement for #{contract.event.name} on HCB 📝" + end + end + private def signee_is_user diff --git a/app/views/api/v4/transactions/_transaction.json.jbuilder b/app/views/api/v4/transactions/_transaction.json.jbuilder index 19d92ce6ea..ddbd9f6015 100644 --- a/app/views/api/v4/transactions/_transaction.json.jbuilder +++ b/app/views/api/v4/transactions/_transaction.json.jbuilder @@ -19,7 +19,7 @@ json.tags hcb_code.tags do |tag| json.emoji tag.emoji end json.code hcb_code.hcb_i1 -json.missing_receipt hcb_code.missing_receipt? +json.missing_receipt hcb_code.missing_receipt?(@event) json.lost_receipt hcb_code.no_or_lost_receipt? json.appearance hcb_code.disbursement.special_appearance_name if hcb_code.disbursement&.special_appearance? && amount.positive? diff --git a/app/views/contract/party_mailer/notify_hcb.html.erb b/app/views/contract/party_mailer/notify_hcb.html.erb index 1d05d7dd45..b1c0f0c76b 100644 --- a/app/views/contract/party_mailer/notify_hcb.html.erb +++ b/app/views/contract/party_mailer/notify_hcb.html.erb @@ -1,7 +1,7 @@ <p>Hi there! 👋</p> <p> - <%= @contract.party(:signee).email %> from <%= @contract.event.name %> is ready for you to sign the fiscal sponsorship agreement! + <%= @contract.party(:signee).email %> from <%= @contract.event.name %> is ready for you (HCB Operations) to sign the fiscal sponsorship agreement! </p> <p> @@ -9,6 +9,6 @@ </p> <p> - Best,<br> - The <%= link_to "HCB", "https://hackclub.com/hcb?utm_source=hcb&utm_medium=email" %> Team + Thanks!<br> + Here's a cookie 🍪 </p> diff --git a/app/views/layouts/_body_suffix.html.erb b/app/views/layouts/_body_suffix.html.erb new file mode 100644 index 0000000000..fb1aae9c8a --- /dev/null +++ b/app/views/layouts/_body_suffix.html.erb @@ -0,0 +1,43 @@ +<%# locals: (skip_fullstory: false) %> +<% if Rails.env.production? && !skip_fullstory %> + <%= render "application/fullstory" if current_user&.sessions_reported %> +<% end %> + +<% if flash[:confetti] %> + <script src="/brand/js-confetti.browser.js"></script> + <script> + const triggerConfetti = () => { + const jsConfetti = new JSConfetti() + const emojis = <%= flash[:confetti_emojis].to_json.html_safe %> + + setTimeout(() => { + if (!emojis) { + jsConfetti.addConfetti() + } else { + jsConfetti.addConfetti({ + emojis: emojis.split(",") + }) + } + }, 100); + }; + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + (async () => { + while (typeof JSConfetti == "undefined") { + await sleep(500); + } + + triggerConfetti() + })(); + </script> +<% end %> +<% if Flipper.enabled?(:transactions_background_2024_06_05, current_user) %> + <style> + .success-dark { + color: #1f8164 + } + </style> +<% end %> diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb new file mode 100644 index 0000000000..ce10c64a19 --- /dev/null +++ b/app/views/layouts/_head.html.erb @@ -0,0 +1,76 @@ +<%# locals: (title_suffix: "HCB", skip_dark_js: false, custom_stylesheet: false, custom_application_js: false, skip_plausible: false, skip_console_art: false, console_art_url: nil) %> +<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> + +<!-- come hack with us on hcb! <%= Rails.configuration.constants.github_url %> --> +<title> + <%= yield(:title).concat(" –") if content_for?(:title) %> + <%= title_suffix %> + +<%= csrf_meta_tags %> +<%= csp_meta_tag %> +"> + + +<%= yield(:before_assets) if content_for?(:before_assets) %> + +<%= javascript_include_tag "dark", 'data-turbo-track': "reload" unless skip_dark_js %> +<%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" unless custom_stylesheet %> +<%= yield(:custom_stylesheet) if content_for?(:custom_stylesheet) %> +<%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true unless custom_application_js %> +<%= yield(:custom_application_js) if content_for?(:custom_application_js) %> +<%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> + +<%= yield(:additional_scripts) if content_for?(:additional_scripts) %> + +<% if Rails.env.production? && !skip_plausible %> + +<% end %> + +<% unless Rails.env.production? %> + +<% end %> + +<% if Rails.env.production? && !skip_console_art %> + +<% end %> + + + +<% if content_for?(:favicon) %> + <%= yield :favicon %> +<% elsif user_birthday? %> + +<% else %> + + +<% end %> + + + + +<%= yield(:additional_head_tags) if content_for?(:additional_head_tags) %> +<%= yield(:head) if content_for?(:head) %> diff --git a/app/views/layouts/_seasonal.html.erb b/app/views/layouts/_seasonal.html.erb new file mode 100644 index 0000000000..fbb9d5e522 --- /dev/null +++ b/app/views/layouts/_seasonal.html.erb @@ -0,0 +1,11 @@ +<%# locals: (snow_style: "height:100%") %> +<%# LET THERE BE SNOW %> +<% if winter? %> + <%= react_component "holiday/Snow", {}, { style: snow_style } %> +<% end %> + +<%# ghosts and ghouls %> +<% if fall? %> + oOoOoOoOo + witch orpheus +<% end %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 703d62d6fc..b219659420 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -1,7 +1,7 @@ - <%= render "layouts/shared_head", + <%= render "layouts/head", title_suffix: "HCB Admin", custom_stylesheet: true, custom_application_js: true, diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 587b0185fe..1ab697c55a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - <%= render "layouts/shared_head" %> + <%= render "layouts/head" %> <%# Web component used for TOTP / donation QR codes %> <%= render "application/helpscout_beacon" %> @@ -15,7 +15,7 @@ options: @tour&.tourable&.try(:tourable_options) || {}, back_to_tour: @back_to_tour %> - <%= render "layouts/shared_seasonal" %> + <%= render "layouts/seasonal" %> <% if content_for?(:nav) %>
@@ -83,6 +83,6 @@
<% end %> - <%= render "layouts/shared_body_suffix" %> + <%= render "layouts/body_suffix" %> diff --git a/app/views/layouts/docs.html.erb b/app/views/layouts/docs.html.erb index f9039ecebc..2d314050ce 100644 --- a/app/views/layouts/docs.html.erb +++ b/app/views/layouts/docs.html.erb @@ -2,7 +2,7 @@ - <%= render "layouts/shared_head", console_art_url: Rails.configuration.constants.hack_on_hcb_form_url %> + <%= render "layouts/head", console_art_url: Rails.configuration.constants.hack_on_hcb_form_url %> <%# Web component used for TOTP / donation QR codes %> @@ -31,7 +31,7 @@
<% end %> - <%= render "layouts/shared_seasonal" %> + <%= render "layouts/seasonal" %> <% if content_for?(:nav) %>
@@ -81,6 +81,6 @@ <% end %> <%= render "application/fullstory" %> - <%= render "layouts/shared_body_suffix" %> + <%= render "layouts/body_suffix" %> diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index e9cdbe00b7..b8c31407cb 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -3,7 +3,7 @@ - <%= render "layouts/shared_head" %> + <%= render "layouts/head" %> -<% end %> diff --git a/app/views/layouts/_shared_head.html.erb b/app/views/layouts/_shared_head.html.erb deleted file mode 100644 index 5f419698bc..0000000000 --- a/app/views/layouts/_shared_head.html.erb +++ /dev/null @@ -1,75 +0,0 @@ -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> - - - - <%= yield(:title).concat(" –") if content_for?(:title) %> - <%= local_assigns[:title_suffix] || "HCB" %> - -<%= csrf_meta_tags %> -<%= csp_meta_tag %> -"> - - -<%= yield(:before_assets) if content_for?(:before_assets) %> - -<%= javascript_include_tag "dark", 'data-turbo-track': "reload" unless local_assigns[:skip_dark_js] %> -<%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" unless local_assigns[:custom_stylesheet] %> -<%= yield(:custom_stylesheet) if content_for?(:custom_stylesheet) %> -<%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true unless local_assigns[:custom_application_js] %> -<%= yield(:custom_application_js) if content_for?(:custom_application_js) %> -<%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %> - -<%= yield(:additional_scripts) if content_for?(:additional_scripts) %> - -<% if Rails.env.production? && !local_assigns[:skip_plausible] %> - -<% end %> - -<% unless Rails.env.production? %> - -<% end %> - -<% if Rails.env.production? && !local_assigns[:skip_console_art] %> - -<% end %> - - - -<% if content_for?(:favicon) %> - <%= yield :favicon %> -<% elsif user_birthday? %> - -<% else %> - - -<% end %> - - - - -<%= yield(:additional_head_tags) if content_for?(:additional_head_tags) %> -<%= yield(:head) if content_for?(:head) %> diff --git a/app/views/layouts/_shared_seasonal.html.erb b/app/views/layouts/_shared_seasonal.html.erb deleted file mode 100644 index c3978f8d5b..0000000000 --- a/app/views/layouts/_shared_seasonal.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%# LET THERE BE SNOW %> -<% if winter? %> - <%= react_component "holiday/Snow", {}, { style: local_assigns[:snow_style] || "height:100%" } %> -<% end %> - -<%# ghosts and ghouls %> -<% if fall? %> - oOoOoOoOo - witch orpheus -<% end %> From f1e39deecd65d44ef0de8c0830c03f799978773f Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Mon, 22 Dec 2025 04:14:40 +0000 Subject: [PATCH 6/9] Fix fullstory --- app/views/layouts/docs.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/docs.html.erb b/app/views/layouts/docs.html.erb index 2d314050ce..893b7a54b1 100644 --- a/app/views/layouts/docs.html.erb +++ b/app/views/layouts/docs.html.erb @@ -81,6 +81,6 @@ <% end %> <%= render "application/fullstory" %> - <%= render "layouts/body_suffix" %> + <%= render "layouts/body_suffix", skip_fullstory: true %> From 4118779c96746cf3492ecf93ace7954c57a0f8fb Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Tue, 23 Dec 2025 13:49:59 -0800 Subject: [PATCH 7/9] Update app/views/layouts/login.html.erb Co-authored-by: Luke Oldenburg <87272260+Luke-Oldenburg@users.noreply.github.com> --- app/views/layouts/login.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index b8c31407cb..9a90a5e4d4 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -32,7 +32,7 @@ class="bg-snow embedded <%= content_for :page_class %> <%= "season-#{current_season}" if current_season %>"> - <%= render "layouts/seasonal", snow_style: "height:0px" %> + <%= render "layouts/seasonal", render_snow: false %> <%= yield(:header) %>
From a8afa9f7c950a0231276b74b0994f24f3129ad14 Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Tue, 23 Dec 2025 13:50:10 -0800 Subject: [PATCH 8/9] Update app/views/layouts/_seasonal.html.erb Co-authored-by: Luke Oldenburg <87272260+Luke-Oldenburg@users.noreply.github.com> --- app/views/layouts/_seasonal.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_seasonal.html.erb b/app/views/layouts/_seasonal.html.erb index fbb9d5e522..2ef4da07f7 100644 --- a/app/views/layouts/_seasonal.html.erb +++ b/app/views/layouts/_seasonal.html.erb @@ -1,7 +1,7 @@ -<%# locals: (snow_style: "height:100%") %> +<%# locals: (render_snow: true) %> <%# LET THERE BE SNOW %> -<% if winter? %> - <%= react_component "holiday/Snow", {}, { style: snow_style } %> +<% if winter? && render_snow %> + <%= react_component "holiday/Snow", {}, { style: "height:100%" } %> <% end %> <%# ghosts and ghouls %> From d6d6c838b1a02643c91c814966a1e75be82c3f08 Mon Sep 17 00:00:00 2001 From: Manu Gurudath Date: Wed, 24 Dec 2025 07:10:34 +0000 Subject: [PATCH 9/9] Fix dark mode! --- app/controllers/application_controller.rb | 4 ++++ app/views/layouts/_head.html.erb | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2caa7d49a2..385f3bbd24 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,6 +48,10 @@ class ApplicationController < ActionController::Base end end + before_action do + @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") + end + # Force usage of Pundit on actions after_action :verify_authorized, unless: -> { controller_path.starts_with?("doorkeeper/") || controller_path.starts_with?("audits1984/") } diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index ce10c64a19..8d8e90001e 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -1,5 +1,4 @@ <%# locals: (title_suffix: "HCB", skip_dark_js: false, custom_stylesheet: false, custom_application_js: false, skip_plausible: false, skip_console_art: false, console_art_url: nil) %> -<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %> @@ -13,7 +12,7 @@ <%= yield(:before_assets) if content_for?(:before_assets) %> -<%= javascript_include_tag "dark", 'data-turbo-track': "reload" unless skip_dark_js %> +<%= javascript_include_tag "dark", 'data-turbo-track': "reload" %> <%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" unless custom_stylesheet %> <%= yield(:custom_stylesheet) if content_for?(:custom_stylesheet) %> <%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true unless custom_application_js %>