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

Me: Adds ability to toggle holiday snow #1138

Merged
merged 2 commits into from
Dec 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions client/me/account/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,36 @@ module.exports = React.createClass( {
}.bind( this ) );
},

renderHolidaySnow() {
let today = this.moment(),
thisYear = today.year();

// Now, let's get the start and end date for the holiday snow feature.
// Note that the isBetween() method does not seem to be inclusive, so we use
// 11-30 and 1-5 for the cut-off dates.
let startDate = this.moment( '2015-11-30' ).year( thisYear ),
endDate = this.moment( '2015-01-05' ).year( thisYear + 1 );

if ( ! today.isBetween( startDate, endDate, 'day' ) ) {
return;
}

return (
<FormFieldset>
<FormLegend>{ this.translate( 'Holiday Snow' ) }</FormLegend>
<FormLabel>
<FormCheckbox
checkedLink={ this.valueLink( 'holidaysnow' ) }
disabled={ this.getDisabledState() }
id="holidaysnow"
name="holidaysnow"
onClick={ this.recordCheckboxEvent( 'Holiday Snow' ) } />
<span>{ this.translate( 'Show snowfall on WordPress.com sites.' ) }</span>
</FormLabel>
</FormFieldset>
);
},

renderJoinDate: function() {
var dateMoment = i18n.moment( user.get().date );

Expand Down Expand Up @@ -381,6 +411,8 @@ module.exports = React.createClass( {
</FormLabel>
</FormFieldset>

{ this.renderHolidaySnow() }

<FormButton
isSubmitting={ this.state.submittingForm }
disabled={ ! this.props.userSettings.hasUnsavedSettings() || this.getDisabledState() }
Expand Down