mirror of
https://github.com/fazo96/homework.git
synced 2025-01-09 12:10:08 +01:00
parent
8add0d0a2c
commit
d3a17dd93b
@ -1,8 +1,10 @@
|
|||||||
# Homework - Client Side
|
# Homework - Client Side
|
||||||
homework_version = "1.0"
|
|
||||||
# Utilities
|
# Utilities
|
||||||
|
tick = new Deps.Dependency()
|
||||||
|
Meteor.setInterval (-> tick.changed();), 15000
|
||||||
|
|
||||||
notes = new Meteor.Collection "notes"
|
notes = new Meteor.Collection "notes"
|
||||||
Meteor.subscribe 'user'
|
userSub = Meteor.subscribe 'user'
|
||||||
getUser = -> Meteor.user()
|
getUser = -> Meteor.user()
|
||||||
deleteAccount = ->
|
deleteAccount = ->
|
||||||
Meteor.call 'deleteMe', (r) -> if r is yes then Router.go 'home'
|
Meteor.call 'deleteMe', (r) -> if r is yes then Router.go 'home'
|
||||||
@ -11,7 +13,9 @@ amIValid = ->
|
|||||||
return yes for mail in getUser().emails when mail.verified is yes; no
|
return yes for mail in getUser().emails when mail.verified is yes; no
|
||||||
|
|
||||||
# Common Helpers for the Templates
|
# Common Helpers for the Templates
|
||||||
UI.registerHelper "loggingIn", -> Meteor.loggingIn()
|
UI.registerHelper "version", -> "1.1.1"
|
||||||
|
UI.registerHelper "status", -> Meteor.status()
|
||||||
|
UI.registerHelper "loading", -> Meteor.loggingIn() or !Meteor.status().connected
|
||||||
UI.registerHelper "email", ->
|
UI.registerHelper "email", ->
|
||||||
if getUser() then return getUser().emails[0].address
|
if getUser() then return getUser().emails[0].address
|
||||||
UI.registerHelper "verified", -> amIValid()
|
UI.registerHelper "verified", -> amIValid()
|
||||||
@ -27,13 +31,28 @@ Router.configure
|
|||||||
layoutTemplate: 'layout'
|
layoutTemplate: 'layout'
|
||||||
loadingTemplate: 'loading'
|
loadingTemplate: 'loading'
|
||||||
notFoundTemplate: '404'
|
notFoundTemplate: '404'
|
||||||
|
action: ->
|
||||||
|
if Meteor.status().connected is no
|
||||||
|
@render 'reconnect'
|
||||||
|
else if Meteor.loggingIn()
|
||||||
|
@render 'loading'
|
||||||
|
else @render()
|
||||||
|
|
||||||
loggedInController = RouteController.extend
|
loggedInController = RouteController.extend
|
||||||
action: -> if @ready then @render() else @render 'loading'
|
action: ->
|
||||||
|
if Meteor.status().connected is no
|
||||||
|
@render 'reconnect'
|
||||||
|
else if !@ready() or Meteor.loggingIn()
|
||||||
|
@render 'loading'
|
||||||
|
else @render()
|
||||||
onBeforeAction: ->
|
onBeforeAction: ->
|
||||||
if not getUser() then Router.go 'home'
|
if not getUser() then Router.go 'home'
|
||||||
if not amIValid() then Router.go 'verifyEmail'
|
if not amIValid() then Router.go 'verifyEmail'
|
||||||
guestController = RouteController.extend
|
guestController = RouteController.extend
|
||||||
|
action: ->
|
||||||
|
if Meteor.status().connected is no
|
||||||
|
@render 'reconnect'
|
||||||
|
else @render()
|
||||||
onBeforeAction: ->
|
onBeforeAction: ->
|
||||||
if getUser()
|
if getUser()
|
||||||
if not amIValid() then Router.go 'verifyEmail' else Router.go 'home'
|
if not amIValid() then Router.go 'verifyEmail' else Router.go 'home'
|
||||||
@ -63,6 +82,7 @@ Router.map ->
|
|||||||
@route 'verifyEmail',
|
@route 'verifyEmail',
|
||||||
path: '/verify/:token?'
|
path: '/verify/:token?'
|
||||||
template: 'verifyEmail'
|
template: 'verifyEmail'
|
||||||
|
controller: guestController
|
||||||
onBeforeAction: ->
|
onBeforeAction: ->
|
||||||
# Automatic verification
|
# Automatic verification
|
||||||
if @params.token? and @params.token isnt ""
|
if @params.token? and @params.token isnt ""
|
||||||
@ -93,6 +113,11 @@ errCallback = (err) ->
|
|||||||
showError msg: err.reason
|
showError msg: err.reason
|
||||||
else showErrror msg: err
|
else showErrror msg: err
|
||||||
|
|
||||||
|
Template.reconnect.time = ->
|
||||||
|
tick.depend()
|
||||||
|
if Meteor.status().retryTime
|
||||||
|
'(retrying '+moment(Meteor.status().retryTime).fromNow()+')'
|
||||||
|
|
||||||
# 3 Buttons navigation Menu
|
# 3 Buttons navigation Menu
|
||||||
Template.menu.events
|
Template.menu.events
|
||||||
'click .go-home': -> Router.go 'home'
|
'click .go-home': -> Router.go 'home'
|
||||||
@ -118,6 +143,7 @@ Template.notelist.active = ->
|
|||||||
Template.notelist.empty = -> Template.notelist.notelist().length is 0
|
Template.notelist.empty = -> Template.notelist.notelist().length is 0
|
||||||
Template.notelist.getDate = ->
|
Template.notelist.getDate = ->
|
||||||
return unless @date
|
return unless @date
|
||||||
|
tick.depend()
|
||||||
#dif = moment(@date, getUser().dateformat).diff(moment(), 'days')
|
#dif = moment(@date, getUser().dateformat).diff(moment(), 'days')
|
||||||
dif = moment.unix(@date).diff(moment(), 'days')
|
dif = moment.unix(@date).diff(moment(), 'days')
|
||||||
color = "primary"
|
color = "primary"
|
||||||
|
@ -9,6 +9,10 @@ input {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.links {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
@ -105,13 +105,13 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<h3 class="cool-header"><i class="fa fa-sign-in fa-2x"></i><br>Sign In</h3>
|
<h3 class="cool-header"><i class="fa fa-sign-in fa-2x"></i><br>Sign In</h3>
|
||||||
{{> error}}
|
{{> error}}
|
||||||
{{#if loggingIn}}
|
{{#if loading}}
|
||||||
{{> loading}}
|
{{> loading}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<input type="text" id="l-mail" class="form-control login in-bt" placeholder="Email">
|
<input type="text" id="l-mail" class="form-control login in-bt" placeholder="Email">
|
||||||
<input type="password" id="l-pass" class="form-control login in-bt" placeholder="Password">
|
<input type="password" id="l-pass" class="form-control login in-bt" placeholder="Password">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless loggingIn}}
|
{{#unless loading}}
|
||||||
<a role="button" href="{{pathFor 'register'}}" class="btn-fix btn btn-success">
|
<a role="button" href="{{pathFor 'register'}}" class="btn-fix btn btn-success">
|
||||||
<i class="fa fa-user"></i> Sign Up</a>
|
<i class="fa fa-user"></i> Sign Up</a>
|
||||||
<a role="button" id="login-btn" class="btn-fix btn btn-primary">
|
<a role="button" id="login-btn" class="btn-fix btn btn-primary">
|
||||||
@ -126,7 +126,7 @@
|
|||||||
<template name="register">
|
<template name="register">
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h3 class="cool-header"><i class="fa fa-user fa-2x"></i><br>New Account</h3>
|
<h3 class="cool-header"><i class="fa fa-user fa-2x"></i><br>New Account</h3>
|
||||||
{{#if loggingIn}}
|
{{#if loading}}
|
||||||
{{> loading}}
|
{{> loading}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<p>Password must be at least 8 characters. You will need to confirm your email.</p>
|
<p>Password must be at least 8 characters. You will need to confirm your email.</p>
|
||||||
@ -225,13 +225,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template name="reconnect">
|
||||||
|
<div align="center" class="spinning-cog">
|
||||||
|
<i class="fa fa-cog fa-spin fa-4x"></i>
|
||||||
|
<h3>Connecting to Server
|
||||||
|
<br><small><b>Status:</b> {{status.status}}
|
||||||
|
{{#if status.reason}}<b>Reason:</b> {{status.reason}}{{/if}}
|
||||||
|
{{time}}
|
||||||
|
</small></h3>
|
||||||
|
<!--<p>If the problem persists, try reloading the page or contact the website administrator.</p>-->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Footer (used in 'template') -->
|
<!-- Footer (used in 'template') -->
|
||||||
<template name="footer">
|
<template name="footer">
|
||||||
<p>This app is <a href="https://en.wikipedia.org/wiki/Free_software">Free Software</a>, under the <a href="http://opensource.org/licenses/MIT">MIT License</a></p>
|
<p>This app is <a href="https://en.wikipedia.org/wiki/Free_software">Free Software</a>, under the <a href="http://opensource.org/licenses/MIT">MIT License</a></p>
|
||||||
<p>Built by Enrico Fasoli</p>
|
<p>Built by Enrico Fasoli</p>
|
||||||
<a class="custom-link" href="http://www.linkedin.com/profile/view?id=292450419"><i class="fa fa-linkedin fa-2x"></i></a>
|
<div class="links">
|
||||||
<a href="http://twitter.com/fazo96"><i class="fa fa-twitter fa-2x footer-center-icon"></i></a>
|
<a class="custom-link" href="http://www.linkedin.com/profile/view?id=292450419"><i class="fa fa-linkedin fa-2x"></i></a>
|
||||||
<a class="custom-link" href="http://github.com/fazo96"><i class="fa fa-github fa-2x"></i></a>
|
<a href="http://twitter.com/fazo96"><i class="fa fa-twitter fa-2x footer-center-icon"></i></a>
|
||||||
|
<a class="custom-link" href="http://github.com/fazo96"><i class="fa fa-github fa-2x"></i></a>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 404 -->
|
<!-- 404 -->
|
||||||
@ -249,7 +263,7 @@
|
|||||||
<template name="homepage">
|
<template name="homepage">
|
||||||
<div align="center"><i class="fa fa-book fa-5x"></i></div>
|
<div align="center"><i class="fa fa-book fa-5x"></i></div>
|
||||||
<p align="center" style="margin-top: 20px" class="lead">A fast, free, organized way to manage your school tasks.</p>
|
<p align="center" style="margin-top: 20px" class="lead">A fast, free, organized way to manage your school tasks.</p>
|
||||||
{{#if loggingIn}}{{> loading}} {{/if}}
|
{{#if loading}}{{> loading}} {{/if}}
|
||||||
<div class="row" align="center">
|
<div class="row" align="center">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<h2><i class="fa fa-code-fork"></i> Free.
|
<h2><i class="fa fa-code-fork"></i> Free.
|
||||||
@ -266,7 +280,7 @@
|
|||||||
<small>Works on all modern <u>Mobile</u> and <u>Desktop</u> browsers.
|
<small>Works on all modern <u>Mobile</u> and <u>Desktop</u> browsers.
|
||||||
Your password is safe and <u>not</u> stored online.</small></h2></div>
|
Your password is safe and <u>not</u> stored online.</small></h2></div>
|
||||||
</div>
|
</div>
|
||||||
{{#unless loggingIn}}
|
{{#unless loading}}
|
||||||
<div align="center" style="margin-top:20px;">
|
<div align="center" style="margin-top:20px;">
|
||||||
<a href="{{pathFor 'login'}}" role="button" class="btn btn-primary">
|
<a href="{{pathFor 'login'}}" role="button" class="btn btn-primary">
|
||||||
<i class="fa fa-sign-in"></i> Sign In
|
<i class="fa fa-sign-in"></i> Sign In
|
||||||
|
Loading…
Reference in New Issue
Block a user