mirror of
https://github.com/fazo96/homework.git
synced 2025-01-10 12:14:22 +01:00
parent
8add0d0a2c
commit
d3a17dd93b
@ -1,8 +1,10 @@
|
||||
# Homework - Client Side
|
||||
homework_version = "1.0"
|
||||
# Utilities
|
||||
tick = new Deps.Dependency()
|
||||
Meteor.setInterval (-> tick.changed();), 15000
|
||||
|
||||
notes = new Meteor.Collection "notes"
|
||||
Meteor.subscribe 'user'
|
||||
userSub = Meteor.subscribe 'user'
|
||||
getUser = -> Meteor.user()
|
||||
deleteAccount = ->
|
||||
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
|
||||
|
||||
# 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", ->
|
||||
if getUser() then return getUser().emails[0].address
|
||||
UI.registerHelper "verified", -> amIValid()
|
||||
@ -27,13 +31,28 @@ Router.configure
|
||||
layoutTemplate: 'layout'
|
||||
loadingTemplate: 'loading'
|
||||
notFoundTemplate: '404'
|
||||
action: ->
|
||||
if Meteor.status().connected is no
|
||||
@render 'reconnect'
|
||||
else if Meteor.loggingIn()
|
||||
@render 'loading'
|
||||
else @render()
|
||||
|
||||
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: ->
|
||||
if not getUser() then Router.go 'home'
|
||||
if not amIValid() then Router.go 'verifyEmail'
|
||||
guestController = RouteController.extend
|
||||
action: ->
|
||||
if Meteor.status().connected is no
|
||||
@render 'reconnect'
|
||||
else @render()
|
||||
onBeforeAction: ->
|
||||
if getUser()
|
||||
if not amIValid() then Router.go 'verifyEmail' else Router.go 'home'
|
||||
@ -63,6 +82,7 @@ Router.map ->
|
||||
@route 'verifyEmail',
|
||||
path: '/verify/:token?'
|
||||
template: 'verifyEmail'
|
||||
controller: guestController
|
||||
onBeforeAction: ->
|
||||
# Automatic verification
|
||||
if @params.token? and @params.token isnt ""
|
||||
@ -93,6 +113,11 @@ errCallback = (err) ->
|
||||
showError msg: err.reason
|
||||
else showErrror msg: err
|
||||
|
||||
Template.reconnect.time = ->
|
||||
tick.depend()
|
||||
if Meteor.status().retryTime
|
||||
'(retrying '+moment(Meteor.status().retryTime).fromNow()+')'
|
||||
|
||||
# 3 Buttons navigation Menu
|
||||
Template.menu.events
|
||||
'click .go-home': -> Router.go 'home'
|
||||
@ -118,6 +143,7 @@ Template.notelist.active = ->
|
||||
Template.notelist.empty = -> Template.notelist.notelist().length is 0
|
||||
Template.notelist.getDate = ->
|
||||
return unless @date
|
||||
tick.depend()
|
||||
#dif = moment(@date, getUser().dateformat).diff(moment(), 'days')
|
||||
dif = moment.unix(@date).diff(moment(), 'days')
|
||||
color = "primary"
|
||||
|
@ -9,6 +9,10 @@ input {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.links {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.close {
|
||||
clear:both;
|
||||
}
|
||||
|
@ -105,13 +105,13 @@
|
||||
<div align="center">
|
||||
<h3 class="cool-header"><i class="fa fa-sign-in fa-2x"></i><br>Sign In</h3>
|
||||
{{> error}}
|
||||
{{#if loggingIn}}
|
||||
{{#if loading}}
|
||||
{{> loading}}
|
||||
{{else}}
|
||||
<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">
|
||||
{{/if}}
|
||||
{{#unless loggingIn}}
|
||||
{{#unless loading}}
|
||||
<a role="button" href="{{pathFor 'register'}}" class="btn-fix btn btn-success">
|
||||
<i class="fa fa-user"></i> Sign Up</a>
|
||||
<a role="button" id="login-btn" class="btn-fix btn btn-primary">
|
||||
@ -126,7 +126,7 @@
|
||||
<template name="register">
|
||||
<div align="center">
|
||||
<h3 class="cool-header"><i class="fa fa-user fa-2x"></i><br>New Account</h3>
|
||||
{{#if loggingIn}}
|
||||
{{#if loading}}
|
||||
{{> loading}}
|
||||
{{else}}
|
||||
<p>Password must be at least 8 characters. You will need to confirm your email.</p>
|
||||
@ -225,13 +225,27 @@
|
||||
</div>
|
||||
</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') -->
|
||||
<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>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>
|
||||
<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 class="links">
|
||||
<a class="custom-link" href="http://www.linkedin.com/profile/view?id=292450419"><i class="fa fa-linkedin 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>
|
||||
|
||||
<!-- 404 -->
|
||||
@ -249,7 +263,7 @@
|
||||
<template name="homepage">
|
||||
<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>
|
||||
{{#if loggingIn}}{{> loading}} {{/if}}
|
||||
{{#if loading}}{{> loading}} {{/if}}
|
||||
<div class="row" align="center">
|
||||
<div class="col-sm-4">
|
||||
<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.
|
||||
Your password is safe and <u>not</u> stored online.</small></h2></div>
|
||||
</div>
|
||||
{{#unless loggingIn}}
|
||||
{{#unless loading}}
|
||||
<div align="center" style="margin-top:20px;">
|
||||
<a href="{{pathFor 'login'}}" role="button" class="btn btn-primary">
|
||||
<i class="fa fa-sign-in"></i> Sign In
|
||||
|
Loading…
Reference in New Issue
Block a user