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

Census announcement: homepage, /yourschool, and cron support #17562

Merged
merged 3 commits into from Sep 7, 2017

Conversation

breville
Copy link
Member

@breville breville commented Sep 6, 2017

This rapidly-assembled PR contains a number of supports for the census announcement. It includes:

  • a copy of the hourofcode.com events map for code.org/yourschool, showing schools that have pledged.
  • a cronjob and associated updated_pledge_map script which takes each pledge's school ID, looks up its ZIP, and puts a pin on the pledge map.
  • homepage support for a special announcement at both desktop and mobile widths, for "en" users.
  • /yourschool notification support for a special announcement.

The final two items are driven by DCDO, and can be activated with something like this:

DCDO.set('census_announcement', {'homepage_text'=> 'This is a special announcement.', 'homepage_subtext' => 'Announcement subtext', 'alert_heading' => 'Announcement heading', 'alert_text'=> "This is the announcement text.", 'alert_url'=> "https://blog.code.org/12345"})

Some screenshots

desktop homepage

screenshot 2017-09-06 16 26 36

mobile homepage

screenshot 2017-09-06 16 26 49

/yourschool with notification

screenshot 2017-09-06 16 26 59

This rapidly-assembled PR contains a numbere of supports for the census announcement.  It includes:

- a copy of the hourofcode.com events map for code.org/yourschool, showing schools that have pledged.
- a cronjob and associated updated_pledge_map script which takes each pledge's school ID, looks up its ZIP, and puts a pin on the pledge map.
- homepage support for a special announcement at both desktop and mobile widths
- /yourschool notification support for a special announcement

The final two items are driven by DCDO, and can be activated with something like this:

DCDO.set('census_announcement', {'homepage_text'=> 'This is a special announcement.', 'homepage_subtext' => 'Announcement subtext', 'alert_heading' => 'Announcement heading', 'alert_text'=> "This is the announcement text.", 'alert_url'=> "https://blog.code.org/12345"})
alertText={$('#your-school').data("parameters-alert-text")}
alertUrl={$('#your-school').data("parameters-alert-url")}
/>,
$('#your-school')[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this to use jquery?

Copy link
Member Author

Choose a reason for hiding this comment

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

I figured if I was going to use jquery for the .data lines, it felt more consistent to use it immediately below. No strong feeling though.

Copy link
Contributor

Choose a reason for hiding this comment

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

My own personal feeling is that $(selector)[0] is okay (but still kind of gross) when selector is reasonably complicated, but that not using jquery is preferred when you have an element id. Might mostly be personal preference tho.

Copy link
Member Author

Choose a reason for hiding this comment

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

Similarly torn.. just not sure whether it's better to have slightly gross jquery or to mix jquery and native JS in the same function :)

tables.authorization = Google::Auth::ServiceAccountCredentials.make_creds(
scope: 'https://www.googleapis.com/auth/fusiontables',
json_key_io: StringIO.new(CDO.hoc_map_account.to_json)
#json_key_io: StringIO.new(CDO.hoc_map_account)
Copy link
Contributor

Choose a reason for hiding this comment

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

old code that can be deleted?

info_window.close();
resizeMap();
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

All this JS should be in an entry point rather than in haml.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I need to merge this for bugbash tomorrow morning but would like to revisit this. Even better would be to de-dupe this with the (virtually identical) JS for the hourofcode.com map. :/

= census_announcement['homepage_subtext']
%a{href: "/yourschool"}
%button{style: "margin-top: 20px"}
Learn more
Copy link
Contributor

Choose a reason for hiding this comment

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

need to be localized? i suspect we already have this string somewhere (or maybe not bc pegasus?)

Copy link
Member Author

Choose a reason for hiding this comment

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

This whole announcement for is "en" only, so while it probably is available as a string, it seems a bit simpler to leave it hardcoded. The other strings are coming direct from DCDO so there won't be any localised strings in this piece of UI.

}

.legend-title {
font-size: 18px;
Copy link
Contributor

Choose a reason for hiding this comment

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

indented too far.

@breville breville merged commit 25cf017 into staging Sep 7, 2017
@breville breville deleted the census-announcement branch September 7, 2017 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants