Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1232 from GoogleChrome/158
Browse files Browse the repository at this point in the history
Set Reminder frontend - Fixes #158
  • Loading branch information
ebidel committed Apr 29, 2015
2 parents 6be427b + a80feb4 commit 7803575
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/elements/io-schedule.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ io-radio-button {

paper-progress {
display: block;
width: 100%;
}

@media (max-width: $phone-breakpoint-max) {
Expand Down
5 changes: 5 additions & 0 deletions app/styles/components/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ h6 {
color: $color-text;
}

paper-progress {
width: 100%;
height: 2px;
}

.typo-white {
color: #fff;
}
Expand Down
1 change: 0 additions & 1 deletion app/styles/pages/schedule.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ core-icon[icon="schedule"] {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
paper-icon-button {
z-index: 10;
Expand Down
46 changes: 43 additions & 3 deletions app/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
<div class="card-content">
<h3><i18n-msg msgid="io-description">Google I/O is for developers—the creative coders who are building what's next. Together we'll explore the latest in tech, mobile &amp; beyond.</i18n-msg></h3>
</div>
<div relative><paper-progress indeterminate fit hidden?="{{!scheduleFetchingUserData}}"></paper-progress></div>
<div class="card-content link-spacing">
<a href="about" data-ajax-link data-transition="hero-card-transition"
data-track-link="home-learn-more-about-io">
<i18n-msg msgid="learnmore">Learn more about I/O</i18n-msg>
</a>
<!-- <a href="#" data-ajax-link data-transition="hero-card-transition"
data-track-link="home-set-reminder" class="notification__feature">
<a href="#" data-ajax-link data-transition="home-set-reminder"
data-track-link="home-set-reminder" class="notification__feature"
on-click="{{onSetReminder}}">
<core-icon icon="io:notifications-none"></core-icon> Set a reminder
</a> -->
</a>
</div>
<div class="ripple">
<div class="ripple__content"></div>
Expand Down Expand Up @@ -211,6 +213,44 @@ <h2><i18n-msg msgid="join-convo">Join the conversation now at #io15</i18n-msg></
IOWA.Elements.Main.querySelector('.globe-marker').classList.remove('up');
};

IOWA.Elements.Template.onSetReminder = function(e, detail, sender) {
e.preventDefault();

var template = this;
template.scheduleFetchingUserData = true;

IOWA.Schedule.saveSession('__keynote__', true).then(function() {
template.scheduleFetchingUserData = false;

if (template.savedSessions.length) {
IOWA.Schedule.updateSavedSessionsUI(IOWA.Elements.Template.savedSessions);
}

// If IOWA.Elements.Template.dontAutoSubscribe is true, this promise will reject immediately, and we'll just
// add the session without attempting to auto-subscribe.
return IOWA.Notifications.subscribePromise(template.dontAutoSubscribe).then(function() {
template.dontAutoSubscribe = false;
IOWA.Elements.Toast.showMessage("Added to My Schedule. You'll be reminded when I/O starts.");
}).catch(function(error) {
template.dontAutoSubscribe = true;
if (error && error.name === 'AbortError') {
// AbortError indicates that the subscription couldn't be completed due to the page
// permissions for notifications being set to denied.
IOWA.Elements.Toast.showMessage(
"You'll be reminded when I/O starts. Want to enable notifications?", null, 'Learn how',
function() {
window.open('permissions', '_blank');
}
);
} else {
// If the subscription failed for some other reason, like because we're not
// auto-subscribing, show the normal toast.
IOWA.Elements.Toast.showMessage('Added to My Schedule.');
}
});
});
};

page.load(); // Run load callback on page load.
page.hasBeenLoaded = true;
}
Expand Down

0 comments on commit 7803575

Please sign in to comment.