mirror of
https://github.com/fazo96/homework.git
synced 2025-01-10 12:14:22 +01:00
fix #16 and other stuff
This commit is contained in:
parent
833dc1f649
commit
edf8ef22a6
@ -30,6 +30,17 @@ Router.configure
|
|||||||
layoutTemplate: 'layout'
|
layoutTemplate: 'layout'
|
||||||
loadingTemplate: 'loading'
|
loadingTemplate: 'loading'
|
||||||
notFoundTemplate: '404'
|
notFoundTemplate: '404'
|
||||||
|
|
||||||
|
loggedInController = RouteController.extend
|
||||||
|
action: -> if @ready then @render() else @render 'loading'
|
||||||
|
onBeforeAction: ->
|
||||||
|
if not getUser() then Router.go 'home'
|
||||||
|
if not amIValid() then Router.go 'verifyEmail'
|
||||||
|
guestController = RouteController.extend
|
||||||
|
onBeforeAction: ->
|
||||||
|
if getUser()
|
||||||
|
if not amIValid() then Router.go 'verifyEmail' else Router.go 'home'
|
||||||
|
|
||||||
Router.map ->
|
Router.map ->
|
||||||
@route 'home',
|
@route 'home',
|
||||||
path: '/'
|
path: '/'
|
||||||
@ -39,29 +50,29 @@ Router.map ->
|
|||||||
# Dispatch user to the right landing page based on his account status
|
# Dispatch user to the right landing page based on his account status
|
||||||
if getUser()
|
if getUser()
|
||||||
if amIValid() is yes then Router.go 'notes' else Router.go 'verifyEmail'
|
if amIValid() is yes then Router.go 'notes' else Router.go 'verifyEmail'
|
||||||
@route 'login',
|
@route 'login', controller: guestController
|
||||||
onBeforeAction: -> Router.go 'home' if getUser()
|
@route 'register', controller: guestController
|
||||||
@route 'register',
|
@route 'account', controller: loggedInController
|
||||||
onBeforeAction: -> Router.go 'home' if getUser()
|
|
||||||
@route 'account',
|
|
||||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
|
||||||
@route 'notes',
|
@route 'notes',
|
||||||
path: '/notes/:_id?'
|
path: '/notes/:_id?'
|
||||||
waitOn: -> Meteor.subscribe "my-notes"
|
waitOn: -> Meteor.subscribe 'my-notes'
|
||||||
data: -> notes.findOne _id: @params._id
|
data: -> notes.findOne _id: @params._id
|
||||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
controller: loggedInController
|
||||||
@route 'archive',
|
@route 'archive',
|
||||||
path: '/archive/:_id?'
|
path: '/archive/:_id?'
|
||||||
waitOn: -> Meteor.subscribe "archive"
|
waitOn: -> @notes = Meteor.subscribe 'archive'
|
||||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
onStop: -> @notes.stop()
|
||||||
|
controller: loggedInController
|
||||||
@route 'verifyEmail',
|
@route 'verifyEmail',
|
||||||
path: '/verify/:token?'
|
path: '/verify/:token?'
|
||||||
template: 'verifyEmail'
|
template: 'verifyEmail'
|
||||||
onBeforeAction: ->
|
onBeforeAction: ->
|
||||||
|
# Automatic verification
|
||||||
if @params.token? and @params.token isnt ""
|
if @params.token? and @params.token isnt ""
|
||||||
|
@render 'loading'
|
||||||
Accounts.verifyEmail @params.token, (err) ->
|
Accounts.verifyEmail @params.token, (err) ->
|
||||||
if err
|
if err
|
||||||
errCallback err; Router.go 'verifyEmail'
|
errCallback err; Router.go 'verifyEmail', token: @params.token
|
||||||
else Router.go 'home'
|
else Router.go 'home'
|
||||||
@route 'homepage', action: -> @render '404'
|
@route 'homepage', action: -> @render '404'
|
||||||
@route '404', path: '*'
|
@route '404', path: '*'
|
||||||
@ -185,6 +196,7 @@ Template.error.error = -> errorDep.depend(); shownError
|
|||||||
Template.error.events 'click .close': -> clearError()
|
Template.error.events 'click .close': -> clearError()
|
||||||
|
|
||||||
# Verify Email page
|
# Verify Email page
|
||||||
|
Template.verifyEmail.token = -> Router.current().params.token
|
||||||
Template.verifyEmail.events
|
Template.verifyEmail.events
|
||||||
'click #btn-verify': (e,template) ->
|
'click #btn-verify': (e,template) ->
|
||||||
t = template.find('#token-field').value; t = t.split("/")
|
t = template.find('#token-field').value; t = t.split("/")
|
||||||
|
@ -54,6 +54,13 @@ input {
|
|||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 442px) {
|
||||||
|
.archive-close-note {
|
||||||
|
margin-top: -25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.note-date{
|
.note-date{
|
||||||
float:right;
|
float:right;
|
||||||
margin-top: -17px;
|
margin-top: -17px;
|
||||||
@ -73,7 +80,6 @@ input {
|
|||||||
|
|
||||||
.edit-note {
|
.edit-note {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<b>{{title}}</b> <span class="note-desc">{{content}}</span>
|
<b>{{title}}</b> <span class="note-desc">{{content}}</span>
|
||||||
<!--<span class="note-date label label-{{getDate.color}}">{{getDate.msg}}</span>-->
|
<!--<span class="note-date label label-{{getDate.color}}">{{getDate.msg}}</span>-->
|
||||||
</span>
|
</span>
|
||||||
<button type="button" class="close-note close">
|
<button type="button" class="close-note close archive-close-note">
|
||||||
<i class="fa fa-trash-o"></i></button>
|
<i class="fa fa-trash-o"></i></button>
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div align="center" class="panel-body">
|
<div align="center" class="panel-body">
|
||||||
<textarea id="area" class="area form-control in-bt" rows="3" placeholder="...">{{content}}</textarea>
|
<textarea id="area" class="area form-control in-bt" rows="3" placeholder="...">{{content}}</textarea>
|
||||||
<input class="form-control date" value="{{date}}" placeholder="Due Date">
|
<!--<input class="form-control date" value="{{date}}" placeholder="Due Date">-->
|
||||||
<button type="button" class="btn btn-info save-editor">Save</button>
|
<button type="button" class="btn btn-info save-editor">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -162,7 +162,7 @@
|
|||||||
Please verify your Email Address<br><small>{{email}}</small></h3>
|
Please verify your Email Address<br><small>{{email}}</small></h3>
|
||||||
<p>Click the link inside the email we sent you or paste it here:</p>
|
<p>Click the link inside the email we sent you or paste it here:</p>
|
||||||
{{> error}}
|
{{> error}}
|
||||||
<input type="text" id="token-field" class="form-control" placeholder="Token">
|
<input type="text" id="token-field" class="form-control" placeholder="Token" value="{{token}}">
|
||||||
<div align="center" class="buttons">
|
<div align="center" class="buttons">
|
||||||
<button type="button" class="btn btn-warning btn-ver" id="btn-resend">
|
<button type="button" class="btn btn-warning btn-ver" id="btn-resend">
|
||||||
<i class="fa fa-refresh"></i> Resend</button>
|
<i class="fa fa-refresh"></i> Resend</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user