Skip to content

Commit

Permalink
Add bootcamp announcement bar (#7114)
Browse files Browse the repository at this point in the history
  • Loading branch information
iHiD authored Oct 31, 2024
1 parent 6d755e8 commit 7fcd319
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/helpers/view_components/site_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand All @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fcd319

Please sign in to comment.