From 7fcd319bb5633faf4bdb71e743fe5fd81506da62 Mon Sep 17 00:00:00 2001 From: Jeremy Walker Date: Thu, 31 Oct 2024 04:39:44 +0000 Subject: [PATCH] Add bootcamp announcement bar (#7114) --- app/helpers/view_components/site_header.rb | 16 ++++++++++++++-- config/initializers/routes.rb | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/helpers/view_components/site_header.rb b/app/helpers/view_components/site_header.rb index ac034d89d8..e630289fca 100644 --- a/app/helpers/view_components/site_header.rb +++ b/app/helpers/view_components/site_header.rb @@ -17,8 +17,9 @@ def to_s end def announcement_bar - return tag.span("") unless user_signed_in? - return tag.span("") if current_user.solutions.count <= 5 + return bootcamp_announcement_bar unless user_signed_in? + return bootcamp_announcement_bar if current_user.solutions.count <= 5 + return tag.span("") if current_user.current_subscription return tag.span("") if current_user.donated_in_last_35_days? @@ -31,6 +32,17 @@ def announcement_bar end end + def bootcamp_announcement_bar + link_to(Exercism::Routes.bootcamp_url, class: "announcement-bar md:block hidden") do + tag.div(class: "lg-container") do + tag.span("👋", class: 'emoji mr-6') + + tag.span("Learning to code? Check out our") + + tag.strong("brand new Bootcamp") + + tag.span("for beginners!") + end + end + end + def logo link_to Exercism::Routes.root_path, class: "exercism-link xl:block", "data-turbo-frame": "tf-main" do icon("exercism-with-logo-black", "Exercism") diff --git a/config/initializers/routes.rb b/config/initializers/routes.rb index b603fb9b31..f634e24ab7 100644 --- a/config/initializers/routes.rb +++ b/config/initializers/routes.rb @@ -36,6 +36,10 @@ def self.solving_exercises_locally_path Exercism::Routes.doc_path('using', 'solving-exercises/working-locally') end + def self.bootcamp_url + "https://bootcamp.exercism.org" + end + def self.routes Rails.application.routes.url_helpers end