Skip to content

Commit

Permalink
Merge pull request #19522 from code-dot-org/remove-special-ui-for-hoc…
Browse files Browse the repository at this point in the history
…-2017

Remove HOC 2017 specific content on homepage, /learn & teacher home
  • Loading branch information
breville committed Dec 14, 2017
2 parents e943266 + 557dc10 commit 561a8a5
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 172 deletions.
1 change: 0 additions & 1 deletion apps/src/sites/studio/pages/home/_homepage.js
Expand Up @@ -147,7 +147,6 @@ function showHomepage() {
id: announcementId
}
]}
hocLaunch={homepageData.hoc_launch}
courses={homepageData.courses}
joinedSections={homepageData.joined_sections}
topCourse={homepageData.topCourse}
Expand Down
72 changes: 2 additions & 70 deletions apps/src/templates/studioHomepages/TeacherHomepage.jsx
Expand Up @@ -2,7 +2,6 @@ import React, {PropTypes, Component} from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import HeaderBanner from '../HeaderBanner';
import {SpecialAnnouncementActionBlock} from './TwoColumnActionBlock';
import Notification from '../Notification';
import RecentCourses from './RecentCourses';
import TeacherSections from './TeacherSections';
Expand All @@ -12,7 +11,6 @@ import ProjectWidgetWithData from '@cdo/apps/templates/projects/ProjectWidgetWit
import shapes from './shapes';
import ProtectedStatefulDiv from '../ProtectedStatefulDiv';
import i18n from "@cdo/locale";
import {pegasus} from '@cdo/apps/lib/util/urlHelpers';

const styles = {
clear: {
Expand All @@ -30,7 +28,6 @@ export default class TeacherHomepage extends Component {
isRtl: PropTypes.bool.isRequired,
queryStringOpen: PropTypes.string,
canViewAdvancedTools: PropTypes.bool,
hocLaunch: PropTypes.object,
isEnglish: PropTypes.bool.isRequired
};

Expand All @@ -42,7 +39,7 @@ export default class TeacherHomepage extends Component {

render() {
const { courses, topCourse, announcements, isRtl, queryStringOpen, joinedSections } = this.props;
const { canViewAdvancedTools, hocLaunch, isEnglish } = this.props;
const { canViewAdvancedTools } = this.props;

return (
<div>
Expand All @@ -56,73 +53,8 @@ export default class TeacherHomepage extends Component {
<ProtectedStatefulDiv
ref="termsReminder"
/>
{hocLaunch &&
hocLaunch.special_announcement &&
(hocLaunch.special_announcement === "mc2017" ||
(hocLaunch.special_announcement === "applab2017" && !isEnglish) ||
(hocLaunch.special_announcement === "celebs2017" && !isEnglish)) && (
<SpecialAnnouncementActionBlock
imageUrl={pegasus('/images/mc/fill-540x289/special-announcement-hoc2017.jpg')}
heading={i18n.specialAnnouncementHeading()}
subHeading={""}
description={i18n.specialAnnouncementDescription()}
buttons={[
{url: 'https://hourofcode.com/#join', text: i18n.joinUs()},
{url: pegasus('/minecraft'), text: i18n.tryIt()}
]}
/>
)}

{hocLaunch &&
hocLaunch.special_announcement &&
hocLaunch.special_announcement === "applab2017" &&
isEnglish && (
<SpecialAnnouncementActionBlock
imageUrl={pegasus('/images/fill-540x289/special-announcements/applab_hoc2017.jpg')}
heading={i18n.specialAnnouncementHeadingAppLab()}
subHeading={""}
description={i18n.specialAnnouncementDescriptionAppLab()}
buttons={[
{url: 'https://hourofcode.com/#join', text: i18n.joinUs()},
{url: pegasus('/learn'), text: i18n.tryIt()}
]}
/>
)}

{hocLaunch &&
hocLaunch.special_announcement &&
hocLaunch.special_announcement === "celebs2017" &&
isEnglish && (
<SpecialAnnouncementActionBlock
imageUrl={pegasus('/images/fill-540x289/special-announcements/celebs_hoc2017.jpg')}
heading={i18n.specialAnnouncementHeading()}
subHeading={""}
description={i18n.specialAnnouncementDescriptionCelebs()}
buttons={[
{url: pegasus('/challenge'), text: i18n.celebrityChallenge()},
{url: pegasus('/learn'), text: i18n.tryHOC()}
]}
/>
)}

{hocLaunch &&
hocLaunch.special_announcement &&
hocLaunch.special_announcement === "celebs2017actualhoc" &&
isEnglish && (
<SpecialAnnouncementActionBlock
imageUrl={pegasus('/images/fill-540x289/special-announcements/celebs_hoc2017.jpg')}
heading={i18n.specialAnnouncementHeadingCelebs()}
subHeading={""}
description={i18n.specialAnnouncementDescriptionCelebs()}
buttons={[
{url: pegasus('/challenge'), text: i18n.celebrityChallenge()},
{url: pegasus('/learn'), text: i18n.tryHOC()}
]}
/>
)}

{announcements.length > 0 &&
!(hocLaunch && hocLaunch.hide_teacher_announcement) && (
{announcements.length > 0 && (
<div>
<Notification
type={announcements[0].type || "bullhorn"}
Expand Down
1 change: 0 additions & 1 deletion dashboard/app/views/home/_homepage.html.haml
Expand Up @@ -14,7 +14,6 @@
- homepage_data[:isTeacher] = true
- homepage_data[:joined_sections] = @student_sections
- homepage_data[:announcement] = DCDO.get('census_announcement', nil)
- homepage_data[:hoc_launch] = DCDO.get('hoc_launch', nil)
- else
- homepage_data[:sections] = @student_sections
- homepage_data[:isTeacher] = false
Expand Down
6 changes: 0 additions & 6 deletions pegasus/sites.v3/code.org/public/learn/index.haml
Expand Up @@ -98,8 +98,6 @@ style_min: false
%script{src: asset_path("js/#{js_locale}/tutorialExplorer_locale.js")}
%script{src: minifiable_asset_path("js/tutorialExplorer.js")}

- hoc_launch = DCDO.get('hoc_launch', nil)

- tutorials_contents = Tutorials.new(:tutorials).contents(request.host_with_port)

- tutorials_contents.each do |tutorial|
Expand All @@ -114,10 +112,6 @@ style_min: false
- tutorial[:string_detail_platforms] = hoc_s(prefix + "string_detail_platforms")
- tutorial[:string_detail_programming_languages] = hoc_s(prefix + "string_detail_programming_languages")

- if hoc_launch && hoc_launch["tutorial_explorer_mc2017_image"]
- if tutorial[:short_code] == "mchoc"
- tutorial[:image] = "/images/tutorials/hoc2017/minecraft2017.png"

#tutorials

:javascript
Expand Down
93 changes: 8 additions & 85 deletions pegasus/sites.v3/code.org/views/homepage_hero.haml
@@ -1,15 +1,4 @@
- hoc_launch = DCDO.get('hoc_launch', nil)
- census_announcement = DCDO.get('census_announcement', nil)
- hoc_mode = DCDO.get('hoc_mode', nil)

-# Whether we show a HOC launch background
- show_hoc_launch_layout = hoc_launch && hoc_launch["homepage"]

-# Non-en users get mc instead of applab/celebs
- if show_hoc_launch_layout
- hoc_launch_hero_variation = hoc_launch["homepage"]
- if ["applab", "celebs"].include?(hoc_launch_hero_variation) && request.language != "en"
- hoc_launch_hero_variation = "mc"

-# Whether we show non-rotating background image and center options on desktop.
- show_census_layout = request.language == "en"
Expand All @@ -19,61 +8,9 @@

- census_announcement_hero = [{"id":99,"id_s":"hero_census_announcement","type_s":"widehero","text1_s":"homepage_hero_text_stat_students","param1_s":"50% 30%","param2_s":"stat","param3_s":"bottom","param4_s":nil,"param5_s":nil,"watermark_s":nil,"image_t":"/images/homepage/announcement.jpg","site_s":"both","active_s":"show","language_supported_s":"all"}]

- hoc_launch_hero = {}

-# Temporary for mc 2017 hoc tutorial launch page
- hoc_launch_hero["mc"] = [{"id":99,"id_s":"mchoc2017","type_s":"widehero","text1_s":"homepage_hero_text_stat_students","param1_s":"50% 30%","param2_s":"stat","param3_s":"bottom","param4_s":nil,"param5_s":nil,"watermark_s":nil,"image_t":"/images/homepage/mchoc2017.jpg","site_s":"both","active_s":"show","language_supported_s":"all"}]

-# Temporary for applab 2017 hoc tutorial launch page
- hoc_launch_hero["applab"] = [{"id":99,"id_s":"applab2017","type_s":"widehero","text1_s":"homepage_hero_text_stat_students","param1_s":"50% 30%","param2_s":"stat","param3_s":"bottom","param4_s":nil,"param5_s":nil,"watermark_s":nil,"image_t":"/images/homepage/applab_hoc2017.jpg","site_s":"both","active_s":"show","language_supported_s":"all"}]

-# Temporary for celebs 2017 launch page: mostly unused but needs an entry.
- hoc_launch_hero["celebs"] = [{"param1_s":"50% 30%"}]

-# hoc_launch_hero["celebs"] = [{"id":99,"id_s":"mchoc2017","type_s":"widehero","text1_s":"homepage_hero_text_stat_students","param1_s":"50% 30%","param2_s":"stat","param3_s":"bottom","param4_s":nil,"param5_s":nil,"watermark_s":nil,"image_t":"/images/homepage/celebs_hoc2017_3.jpg","site_s":"both","active_s":"show","language_supported_s":"all"}]
- actions = DB[:cdo_homepage].where(type_s: "action", active_s: ["show","hide"], site_s: [request.site,"both"], language_supported_s: ["all", languageFilter]).all

-# Temporary for mc 2017 hoc tutorial launch page
- if show_hoc_launch_layout && hoc_launch_hero_variation == "mc"
.desktop-feature
%img{src: "/images/fit-300/mc/MC_Logo_Large.png", style: "position: absolute; width: 300px; left: 20px; top: 237px;"}
.mobile-feature{style: "width: 100%; text-align: center; "}
%img{src: "/images/fit-300/mc/MC_Logo_Large.png", style: "position: absolute; width: 300px; top: 237px; margin-left: auto; margin-right: auto; left: 0; right: 0;"}
-# Since we're up to real Hour of Code, non-en users should see actual-hoc actions
- if request.language != "en"
- actions = [{param1_s: "cta_button", text1_s: "get_started", param2_s: "/learn"}]
-# Temporary for applab 2017 hoc tutorial launch page
- if show_hoc_launch_layout && hoc_launch_hero_variation == "applab"
.desktop-feature
%img{src: "/images/homepage/fit-300/applab_hoc2017_logo.png", style: "position: absolute; width: 300px; right: 60px; top: 237px;"}
.mobile-feature{style: "width: 100%; text-align: center; "}
%img{src: "/images/homepage/fit-300/applab_hoc2017_logo.png", style: "position: absolute; width: 300px; top: 237px; margin-left: auto; margin-right: auto; left: 0; right: 0;"}
- actions = [{param1_s: "cta_button", text1_s: "homepage_action_text_join_us", param2_s: "https://hourofcode.com/#join"}, {param1_s: "cta_button_secondary", text1_s: "homepage_action_text_try_it", param2_s: "/hourofcode/overview"}]

-# Temporary for celebs 2017 launch page
- if show_hoc_launch_layout && hoc_launch_hero_variation == "celebs"
.mobile-feature{style: "width: 100%; text-align: center; "}
%img{src: "/images/homepage/fit-300/celebs_hoc2017_logo.png", style: "position: absolute; width: 250px; top: 137px; margin-left: auto; margin-right: auto; left: 0; right: 0;"}
- actions = [{param1_s: "cta_button", text1_s: "get_started", param2_s: "/learn"}, {param1_s: "cta_button_secondary", text1_s: "homepage_action_text_wincelebritychat", param2_s: "/challenge"}]
- main_actions = capture_haml do
-# Temporary heading text for the Hour of Code
- if request.language == "en"
- if show_hoc_launch_layout && hoc_launch_hero_variation == "celebs" && hoc_mode == 'actual-hoc'
= I18n.t(:homepage_hero_hoc_is_here)
- else
= I18n.t(:homepage_hero_hoc_is_coming)
- elsif show_hoc_launch_layout && hoc_launch_hero_variation == "mc"
-# Now that Hour of Code is here, we want to show non-en users a heading
= I18n.t(:homepage_action_text_hoc)
%br/
%br/
- actions.each_with_index do |entry, index|
- display = entry[:active_s] == "hide" ? "none" : "block"
.action
Expand Down Expand Up @@ -107,12 +44,7 @@
.bigheading{style: "font-size: 20px; line-height: 1.2em; font-family: 'Gotham 7r', sans-serif;"}
= census_announcement['homepage_text']
.subheading{style: "padding-top: 0px; font-size: 18px;"}
-# Temporary for celebs 2017 launch page: narrow text
- if show_hoc_launch_layout && hoc_launch_hero_variation == "celebs"
.subheadingtext{style: "width: 230px; display: inline-block"}
= census_announcement['homepage_subtext']
- else
= census_announcement['homepage_subtext']
= census_announcement['homepage_subtext']
%a{href: "/yourschool"}
%button{style: "min-width: 230px; font-size: 18px; margin-top: 15px; background-color: transparent; border-color: white; border-width: 2px"}
Expand All @@ -130,8 +62,6 @@
- elsif rack_env != :production && request.params["lock-hero"]
-# for UI tests just lock to the first hero image
- heroes_arranged = heroes[0, 1]
- elsif show_hoc_launch_layout
- heroes_arranged = hoc_launch_hero[hoc_launch_hero_variation]
- elsif show_census_layout
- heroes_arranged = census_announcement_hero
- else
Expand Down Expand Up @@ -166,19 +96,12 @@
- display = entry[:active_s] == "hide" ? "none" : "block"
-# Preload the first hero image to render immediately, lazy-load the rest to conserve bandwidth.
- if index == 0
- if show_hoc_launch_layout && hoc_launch_hero_variation == "celebs"
- response.add_header 'Link', "</images/homepage/celebs_hoc2017_mobile_1x.jpg>; rel=preload; as=image; media=\"#{css_retina?(false)}\";"
- response.add_header 'Link', "</images/homepage/celebs_hoc2017_desktop_1x.jpg>; rel=preload; as=image; media=\"#{css_retina?}\";"
.widehero_do_not_hide.mobile-feature{style: "background-image: url(\"/images/homepage/celebs_hoc2017_mobile_1x.jpg\"); background-position: #{entry[:param1_s]}; z-index: -5"}
.widehero_do_not_hide.desktop-feature{style: "background-image: url(\"/images/homepage/celebs_hoc2017_desktop_1x.jpg\"); background-position: #{entry[:param1_s]}; z-index: -5"}

- else
-#
Use Link rel=preload HTTP headers to preload as early as possible.
Two headers with inverse media queries conditionally load the correctly-sized image.
- response.add_header 'Link', "<#{entry[:image_t]}>; rel=preload; as=image; media=\"#{css_retina?(false)}\";"
- response.add_header 'Link', "<#{entry[:image_t].gsub('.jpg', '_2x.jpg')}>; rel=preload; as=image; media=\"#{css_retina?}\";"
.widehero#fullwidth0{style: "background-position: #{entry[:param1_s]}; background-image: url(#{entry[:image_t]});"}
-#
Use Link rel=preload HTTP headers to preload as early as possible.
Two headers with inverse media queries conditionally load the correctly-sized image.
- response.add_header 'Link', "<#{entry[:image_t]}>; rel=preload; as=image; media=\"#{css_retina?(false)}\";"
- response.add_header 'Link', "<#{entry[:image_t].gsub('.jpg', '_2x.jpg')}>; rel=preload; as=image; media=\"#{css_retina?}\";"
.widehero#fullwidth0{style: "background-position: #{entry[:param1_s]}; background-image: url(#{entry[:image_t]});"}
- else
.widehero.lazyload{id: "fullwidth#{index}", "data-bg"=> "#{entry[:image_t]}", style: "background-position: #{entry[:param1_s]}"}

Expand All @@ -192,7 +115,7 @@
= view :mobile_header_responsive

#caption_container.container_responsive
- if show_census_layout || show_hoc_launch_layout
- if show_census_layout
.bigannounce{style: "padding: 20px; text-align: center"}
#actions
= main_actions
Expand Down
4 changes: 1 addition & 3 deletions pegasus/sites.v3/code.org/views/stats_homepage.haml
@@ -1,8 +1,6 @@
:ruby
hoc_mode = DCDO.get('hoc_mode', nil)

student_accounts_percent = "25%"
female_students = hoc_mode == 'actual-hoc' ? "10M" : "9M"
female_students = "10M"
teacher_users = "700K"
world_students_hoc_percent = "10%"
states_policy_change = "20"
Expand Down
6 changes: 0 additions & 6 deletions pegasus/sites.v3/hourofcode.com/public/learn/index.haml
Expand Up @@ -92,8 +92,6 @@ social:
%script{src: asset_path("js/#{js_locale}/tutorialExplorer_locale.js")}
%script{src: minifiable_asset_path("js/tutorialExplorer.js")}

- hoc_launch = DCDO.get('hoc_launch', nil)

-# Load tutorial images from code.org so we don't have to duplicate them on hourofcode.com.
- tutorials_contents = Tutorials.new(:tutorials).contents(request.host_with_port)
- tutorials_contents.each do |tutorial|
Expand All @@ -111,10 +109,6 @@ social:
- tutorial[:string_detail_platforms] = hoc_s(prefix + "string_detail_platforms")
- tutorial[:string_detail_programming_languages] = hoc_s(prefix + "string_detail_programming_languages")

- if hoc_launch && hoc_launch["tutorial_explorer_mc2017_image"]
- if tutorial[:short_code] == "mchoc"
- tutorial[:image] = CDO.code_org_url("/images/tutorials/hoc2017/minecraft2017.png")

#tutorials

.clear{style: "clear: both"}
Expand Down

0 comments on commit 561a8a5

Please sign in to comment.