Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage: Display bhm link instead of video for en-US #39027

Merged
merged 3 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions pegasus/sites.v3/code.org/public/css/homepage.css
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,25 @@ body.modal-open .supreme-container{
margin: 10px 5px 0 0;
}

#homepage #actions .herolink-white {
font-family: 'Gotham 4r', sans-serif;
font-weight: 500;
font-size: 18px;
color: white;
display: inline-block;
margin-top: 24px
}

#homepage #actions .herolink-white i {
vertical-align: middle;
margin-right: 5px;
font-size: 26px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, was 26px just the size that made things look right or was there a reason for picking this value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specifically for the icon style i, I just looked at the mocks in the ticket and it was the size that looked most like the icon in the mocks.

}

#homepage #actions .herolink-white span {
vertical-align: middle;
}

#homepage #actions .herohocbutton-solid-white {
color: black;
background-color: white;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pegasus/sites.v3/code.org/views/homepage_hero.haml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
%div
%a{onclick: "return showVideo_mainvideo();", style: "cursor: pointer"}
%img{src: "images/homepage/watch_video_drawn_button.png", style: "width: 250px; margin-top: 10px"}
- elsif entry[:type] == "cta_link_white"
%a.herohocbutton.herolink-white{href: entry[:href]}
%i.fa{class: entry[:icon_class]}
%span= entry[:plain_text]

.clear{style: "clear: both"}

Expand Down
28 changes: 19 additions & 9 deletions pegasus/src/homepage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,31 @@ def self.get_actions(request)
}
]
elsif ["post-hoc", "pre-hoc"].include? hoc_mode
[
actions = [
{
text: "homepage_action_text_learn",
type: "cta_button",
url: CDO.studio_url("/courses"),
},
{
text: "homepage_action_text_codevideo",
type: "video",
youtube_id: youtube_id,
download_path: download_path,
facebook: facebook,
twitter: twitter
}
]

code_video_action = {
text: "homepage_action_text_codevideo",
type: "video",
youtube_id: youtube_id,
download_path: download_path,
facebook: facebook,
twitter: twitter
}

bhm_action = {
type: "cta_link_white",
icon_class: "fa-arrow-circle-o-right",
href: "/blackhistorymonth",
plain_text: "Celebrate Black History Month with us!"
}

actions.push(I18n.locale == :"en-US" ? bhm_action : code_video_action)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(very minor) Is locale a symbol or a string? (In most places, I see us just compare to en-US but don't know which is more correct. Either way, not too important.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symbol, I tried as a string, it didn't work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious whether there's a standard of how we determine locale? I see elsewhere in that same file we look at request.locale, do you happen to know the difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not - I'm assuming that the i18n locale is somehow set by the request locale?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds plausible :)

else
[
{
Expand Down