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'
|
||||
loadingTemplate: 'loading'
|
||||
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 ->
|
||||
@route 'home',
|
||||
path: '/'
|
||||
@ -39,29 +50,29 @@ Router.map ->
|
||||
# Dispatch user to the right landing page based on his account status
|
||||
if getUser()
|
||||
if amIValid() is yes then Router.go 'notes' else Router.go 'verifyEmail'
|
||||
@route 'login',
|
||||
onBeforeAction: -> Router.go 'home' if getUser()
|
||||
@route 'register',
|
||||
onBeforeAction: -> Router.go 'home' if getUser()
|
||||
@route 'account',
|
||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
||||
@route 'login', controller: guestController
|
||||
@route 'register', controller: guestController
|
||||
@route 'account', controller: loggedInController
|
||||
@route 'notes',
|
||||
path: '/notes/:_id?'
|
||||
waitOn: -> Meteor.subscribe "my-notes"
|
||||
waitOn: -> Meteor.subscribe 'my-notes'
|
||||
data: -> notes.findOne _id: @params._id
|
||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
||||
controller: loggedInController
|
||||
@route 'archive',
|
||||
path: '/archive/:_id?'
|
||||
waitOn: -> Meteor.subscribe "archive"
|
||||
onBeforeAction: -> if not getUser() then Router.go 'home'
|
||||
waitOn: -> @notes = Meteor.subscribe 'archive'
|
||||
onStop: -> @notes.stop()
|
||||
controller: loggedInController
|
||||
@route 'verifyEmail',
|
||||
path: '/verify/:token?'
|
||||
template: 'verifyEmail'
|
||||
onBeforeAction: ->
|
||||
# Automatic verification
|
||||
if @params.token? and @params.token isnt ""
|
||||
@render 'loading'
|
||||
Accounts.verifyEmail @params.token, (err) ->
|
||||
if err
|
||||
errCallback err; Router.go 'verifyEmail'
|
||||
errCallback err; Router.go 'verifyEmail', token: @params.token
|
||||
else Router.go 'home'
|
||||
@route 'homepage', action: -> @render '404'
|
||||
@route '404', path: '*'
|
||||
@ -185,6 +196,7 @@ Template.error.error = -> errorDep.depend(); shownError
|
||||
Template.error.events 'click .close': -> clearError()
|
||||
|
||||
# Verify Email page
|
||||
Template.verifyEmail.token = -> Router.current().params.token
|
||||
Template.verifyEmail.events
|
||||
'click #btn-verify': (e,template) ->
|
||||
t = template.find('#token-field').value; t = t.split("/")
|
||||
|
@ -54,6 +54,13 @@ input {
|
||||
margin-top: -2px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
@media (max-width: 442px) {
|
||||
.archive-close-note {
|
||||
margin-top: -25px;
|
||||
}
|
||||
}
|
||||
|
||||
.note-date{
|
||||
float:right;
|
||||
margin-top: -17px;
|
||||
@ -73,7 +80,6 @@ input {
|
||||
|
||||
.edit-note {
|
||||
display: inline-block;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
<b>{{title}}</b> <span class="note-desc">{{content}}</span>
|
||||
<!--<span class="note-date label label-{{getDate.color}}">{{getDate.msg}}</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>
|
||||
</a>
|
||||
{{/each}}
|
||||
@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div align="center" class="panel-body">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@ -162,7 +162,7 @@
|
||||
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>
|
||||
{{> 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">
|
||||
<button type="button" class="btn btn-warning btn-ver" id="btn-resend">
|
||||
<i class="fa fa-refresh"></i> Resend</button>
|
||||
|
Loading…
Reference in New Issue
Block a user