Skip to content

Commit

Permalink
Refactor, fix signup code, add signup template override
Browse files Browse the repository at this point in the history
  • Loading branch information
ryw committed Dec 10, 2013
1 parent ce5f48e commit ad0381d
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 68 deletions.
19 changes: 19 additions & 0 deletions client/entry.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
AccountsEntry =
settings:
wrapLinks: true
homeRoute: '/home'
dashboardRoute: '/dashboard'

config: (appConfig) ->
@settings = _.extend(@settings, appConfig)

if appConfig.signUpTemplate
Router.routes = _.reject Router.routes, (e, i) ->
e.name is 'entrySignUp'

Router.map ->
@route 'signUp',
path: 'sign-up',
template: appConfig.signUpTemplate

@AccountsEntry = AccountsEntry
File renamed without changes.
27 changes: 27 additions & 0 deletions client/helpers.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if typeof Handlebars isnt "undefined"
Handlebars.registerHelper "signedInAs", (date) ->
if Meteor.user().username
Meteor.user().username
else if Meteor.user().profile.name
Meteor.user().profile.name
else if Meteor.user().emails and Meteor.user().emails[0]
Meteor.user().emails[0].address
else
"Signed In"

Handlebars.registerHelper 'accountButtons', ->
return new Handlebars.SafeString(Template.entryAccountButtons())

Handlebars.registerHelper 'capitalize', (str) ->
str.charAt(0).toUpperCase() + str.slice(1)

Handlebars.registerHelper 'signupClass', ->
if Accounts.oauth && Accounts.oauth.serviceNames().length > 0
"collapse"

Handlebars.registerHelper 'otherLoginServices', ->
Accounts.oauth &&
Accounts.oauth.serviceNames().length > 0

Handlebars.registerHelper 'loginServices', ->
Accounts.oauth.serviceNames()
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Handlebars.registerHelper "accountButtons", ->
return new Handlebars.SafeString(Template.entryAccountButtons())

Template.entryAccountButtons.helpers
profileUrl: ->
return false unless AccountsEntry.settings.profileRoute
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions helper.js

This file was deleted.

54 changes: 29 additions & 25 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Package.describe({
});

Package.on_use(function(api) {

// CLIENT
api.use([
'deps',
'service-configuration',
Expand All @@ -16,41 +18,43 @@ Package.on_use(function(api) {
'less']
, 'client');

api.imply('accounts-base', ['client', 'server']);

api.add_files([
'shared/start.coffee',
'sign-in/signIn.html',
'sign-in/signIn.coffee',
'sign-up/signUp.html',
'sign-up/signUp.coffee',
'forgot-password/forgotPassword.html',
'forgot-password/forgotPassword.coffee',
'reset-password/resetPassword.html',
'reset-password/resetPassword.coffee',
'shared/social.html',
'shared/social.coffee',
'shared/error.html',
'shared/error.coffee',
'shared/accountButtons.html',
'shared/accountButtons.coffee',
'entry.less',
'helper.js']
, 'client');
'client/entry.coffee',
'client/entry.less',
'client/helpers.coffee',
'client/views/signIn/signIn.html',
'client/views/signIn/signIn.coffee',
'client/views/signUp/signUp.html',
'client/views/signUp/signUp.coffee',
'client/views/forgotPassword/forgotPassword.html',
'client/views/forgotPassword/forgotPassword.coffee',
'client/views/resetPassword/resetPassword.html',
'client/views/resetPassword/resetPassword.coffee',
'client/views/social/social.html',
'client/views/social/social.coffee',
'client/views/error/error.html',
'client/views/error/error.coffee',
'client/views/accountButtons/accountButtons.html',
'client/views/accountButtons/accountButtons.coffee'
], 'client');

// SERVER
api.use([
'deps',
'service-configuration',
'accounts-password',
'accounts-base',
'underscore',
'coffeescript']
, 'server');
'coffeescript'
], 'server');

api.export('AccountsEntry', ['client', 'server']);
api.add_files('entry.coffee', 'server');
api.add_files(['server/entry.coffee'], 'server');

// CLIENT and SERVER
api.imply('accounts-base', ['client', 'server']);
api.export('AccountsEntry', ['client', 'server']);
api.use('iron-router', ['client', 'server']);
api.add_files('router.coffee', ['client', 'server']);
api.add_files('server/accountsUrl.coffee', 'server');
api.add_files(['shared/router.coffee'], ['client', 'server']);

});
2 changes: 0 additions & 2 deletions server/accountsUrl.coffee

This file was deleted.

5 changes: 4 additions & 1 deletion entry.coffee → server/entry.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Meteor.startup ->
Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)

AccountsEntry =
settings: {}

Expand All @@ -9,7 +12,7 @@ Meteor.startup ->

Meteor.methods
entryValidateSignupCode: (signupCode) ->
not AccountsEntry.settings.showSignupCode or signupCode is AccountsEntry.settings.signupCode
signupCode is AccountsEntry.settings.signupCode

accountsCreateUser: (username, email, password) ->
if username
Expand Down
File renamed without changes.
24 changes: 0 additions & 24 deletions shared/start.coffee

This file was deleted.

0 comments on commit ad0381d

Please sign in to comment.