Skip to content

Commit

Permalink
Updated homepage (winsleague#188)
Browse files Browse the repository at this point in the history
* start sending enrollment mail on account creation

* new homepage messaging and dashboard layout

* fixed email template
  • Loading branch information
noahsw authored Aug 14, 2016
1 parent 15ef65b commit 65b07ad
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion app/imports/api/pool_teams/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function createOrExistingUserId(email) {
Accounts.createUser({ email });
const newUser = Accounts.findUserByEmail(email);
log.debug(`Created new user: ${newUser._id}`);
// TODO: Accounts.sendEnrollmentMail() so user can login
Accounts.sendEnrollmentEmail(newUser._id);
return newUser._id;
}

Expand Down
5 changes: 3 additions & 2 deletions app/imports/startup/server/accounts_email_templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ Accounts.emailTemplates.siteName = 'Wins League';
Accounts.emailTemplates.from = 'Wins League <[email protected]>';

Accounts.emailTemplates.enrollAccount.subject = (user) =>
`Welcome to Wins League, ${user.profile.name}`;
'Welcome to Wins League';

Accounts.emailTemplates.enrollAccount.text = (user, url) =>
`You have registered for Wins League!
`Wins League is a simple form fantasy sports, but just as much fun.
To activate your account, simply click the link below:
${url}`;
15 changes: 9 additions & 6 deletions app/imports/ui/components/home/intro.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<template name="intro">
<h2 class="home">Simple Fantasy Sports</h2>

<h3>How it works</h3>
<h3 class="home">Simple fantasy sports</h3>
<ol>
<li>Each player drafts a set of teams.</li>
<li>You and your friends each draft a set of teams.</li>
<li>Follow your teams and their stats throughout the season.</li>
<li>Whoever has the most total wins by the end is crowned champion!</li>
</ol>
<br/>

<a class="btn btn-primary" href="{{pathFor 'Pools.new'}}">Create Pool</a>&nbsp;
<a class="btn btn-primary" href="/sign-up">Create Pool</a>&nbsp;

<a class="btn btn-default" href="/pools/6Z6QJMFvcgQ2PALsS/seasons/t6bHBR34se99MXgdi">View Demo</a>

<br/><br/>

Inspired by Bill Simmons and his post on <a href="http://grantland.com/the-triangle/you-should-have-an-nfl-wins-pool/">Grantland</a>.

<a class="btn btn-default" href="/pools/6Z6QJMFvcgQ2PALsS">View Demo</a>
</template>
4 changes: 4 additions & 0 deletions app/imports/ui/components/pools-wins.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Template.Pools_wins.helpers({
},
});
},

title: () => {
const title = Template.currentData().title;
if (Template.currentData().linkTitle) {
Expand All @@ -30,6 +31,9 @@ Template.Pools_wins.helpers({
}
return title;
},

isCommissioner: () => Meteor.userId() === _.get(Template.instance().getPool(),
'commissionerUserId'),
});

Template.Pools_wins.onCreated(function () {
Expand Down
4 changes: 4 additions & 0 deletions app/imports/ui/components/user-dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ <h2 id="User_dashboard_title">Dashboard</h2>
}}
{{/each}}
{{/if}}

<br/>

<a class="btn btn-primary" href="{{pathFor 'Pools.new'}}">Create Pool</a>
</template>
1 change: 1 addition & 0 deletions app/imports/ui/layouts/app-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
</div>
<div class="container">
{{> Template.dynamic template=content}}
<br/><br/>
</div>
</template>
46 changes: 24 additions & 22 deletions app/imports/ui/pages/pools-show-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,44 @@
{{#if Template.subscriptionsReady}}
{{> Pools_header poolId=poolId seasonId=seasonId }}

{{> Pools_wins
poolId=poolId
seasonId=seasonId
isCommissioner=isCommissioner
}}
{{#if poolTeamCount}}
{{> Pools_wins
poolId=poolId
seasonId=seasonId
isCommissioner=isCommissioner
}}

{{> Pools_pick_quality
leagueId=leagueId
seasonId=seasonId
poolId=poolId
tableTitle="Best Pick Quality"
sort=-1
}}
{{> Pools_pick_quality
leagueId=leagueId
seasonId=seasonId
poolId=poolId
tableTitle="Best Pick Quality"
sort=-1
}}

{{> Pools_pick_quality
leagueId=leagueId
seasonId=seasonId
poolId=poolId
tableTitle="Worst Pick Quality"
sort=1
}}
{{> Pools_pick_quality
leagueId=leagueId
seasonId=seasonId
poolId=poolId
tableTitle="Worst Pick Quality"
sort=1
}}
{{/if}}

{{> Pools_season_switcher
poolId=poolId
}}

<a href="{{pathFor 'Pools.records' poolId=poolId}}" id="Pools_records">Records</a><br/>
<br/>

{{#if isCommissioner}}
{{#if isLatestSeason}}
<a href="{{pathFor 'PoolTeams.new' poolId=poolId}}" id="PoolTeams_new">Add Player</a>
<br/>
{{/if}}
<a href="{{pathFor 'Pools.edit' poolId=poolId}}" id="Pools_edit">Edit Pool</a>
{{/if}}
<br/>

<a href="{{pathFor 'Pools.records' poolId=poolId}}" id="Pools_records">Records</a><br/>
{{else}}
<div>Loading...</div>
{{/if}}
Expand Down
5 changes: 5 additions & 0 deletions app/imports/ui/pages/pools-show-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '../components/pools-pick-quality';
import '../components/pools-season-switcher';

import { Pools } from '../../api/pools/pools';
import { PoolTeams } from '../../api/pool_teams/pool_teams';
import SeasonFinder from '../../api/seasons/finder';

Template.Pools_show_page.helpers({
Expand All @@ -31,6 +32,8 @@ Template.Pools_show_page.helpers({
}
return true;
},

poolTeamCount: () => PoolTeams.find(),
});

Template.Pools_show_page.onCreated(function () {
Expand Down Expand Up @@ -59,6 +62,8 @@ Template.Pools_show_page.onCreated(function () {
Session.setPersistent('previousPoolId', this.getPoolId());
});

this.subscribe('poolTeams.ofPool', this.getPoolId(), this.getSeasonId());

this.subscribe('seasons.single', this.getSeasonId());

this.subscribe('seasons.latest.ofLeague', this.getLeagueId());
Expand Down

0 comments on commit 65b07ad

Please sign in to comment.