1
0
mirror of https://github.com/fazo96/markcloud.git synced 2025-01-10 11:04:21 +01:00

upgraded to meteor 1.0 and iron router 1.0

This commit is contained in:
fazo96 2014-11-14 08:46:04 +01:00
parent eb967d5b13
commit 74d70c9b30
3 changed files with 106 additions and 93 deletions

View File

@ -1 +1 @@
METEOR@0.9.4 METEOR@1.0

View File

@ -1,20 +1,20 @@
accounts-base@1.1.2 accounts-base@1.1.2
accounts-oauth@1.1.2 accounts-oauth@1.1.2
accounts-password@1.0.3 accounts-password@1.0.4
accounts-twitter@1.0.2 accounts-twitter@1.0.2
application-configuration@1.0.3 application-configuration@1.0.3
autoupdate@1.1.2 autoupdate@1.1.3
base64@1.0.1 base64@1.0.1
binary-heap@1.0.1 binary-heap@1.0.1
blaze-tools@1.0.1 blaze-tools@1.0.1
blaze@2.0.2 blaze@2.0.3
boilerplate-generator@1.0.1 boilerplate-generator@1.0.1
callback-hook@1.0.1 callback-hook@1.0.1
check@1.0.2 check@1.0.2
coffeescript@1.0.4 coffeescript@1.0.4
ctl-helper@1.0.4 ctl-helper@1.0.4
ctl@1.0.2 ctl@1.0.2
ddp@1.0.10 ddp@1.0.11
deps@1.0.5 deps@1.0.5
ejson@1.0.4 ejson@1.0.4
email@1.0.4 email@1.0.4
@ -23,31 +23,36 @@ follower-livedata@1.0.2
geojson-utils@1.0.1 geojson-utils@1.0.1
html-tools@1.0.2 html-tools@1.0.2
htmljs@1.0.2 htmljs@1.0.2
http@1.0.7 http@1.0.8
id-map@1.0.1 id-map@1.0.1
iron:core@0.3.4 iron:controller@1.0.0
iron:dynamic-template@0.4.1 iron:core@1.0.0
iron:layout@0.4.1 iron:dynamic-template@1.0.0
iron:router@0.9.4 iron:layout@1.0.0
iron:location@1.0.1
iron:middleware-stack@1.0.0
iron:router@1.0.1
iron:url@1.0.0
jquery@1.0.1 jquery@1.0.1
json@1.0.1 json@1.0.1
kevohagan:sweetalert@0.0.1 kevohagan:sweetalert@0.3.1
less@1.0.10 launch-screen@1.0.0
less@1.0.11
livedata@1.0.11 livedata@1.0.11
localstorage@1.0.1 localstorage@1.0.1
logging@1.0.4 logging@1.0.5
meteor-platform@1.1.2 meteor-platform@1.2.0
meteor@1.1.2 meteor@1.1.3
minifiers@1.1.1 minifiers@1.1.2
minimongo@1.0.4 minimongo@1.0.5
mizzao:bootstrap-3@3.2.0_1 mizzao:bootstrap-3@3.3.0
mobile-status-bar@1.0.1 mobile-status-bar@1.0.1
mongo@1.0.7 mongo@1.0.8
mrt:moment@2.8.1 mrt:moment@2.8.1
natestrauser:font-awesome@4.2.0 natestrauser:font-awesome@4.2.0
npm-bcrypt@0.7.7 npm-bcrypt@0.7.7
oauth1@1.1.1 oauth1@1.1.2
oauth@1.1.1 oauth@1.1.2
observe-sequence@1.0.3 observe-sequence@1.0.3
ordered-dict@1.0.1 ordered-dict@1.0.1
perak:markdown@1.0.4 perak:markdown@1.0.4
@ -58,17 +63,17 @@ reload@1.1.1
retry@1.0.1 retry@1.0.1
routepolicy@1.0.2 routepolicy@1.0.2
service-configuration@1.0.2 service-configuration@1.0.2
session@1.0.3 session@1.0.4
sha@1.0.1 sha@1.0.1
spacebars-compiler@1.0.3 spacebars-compiler@1.0.3
spacebars@1.0.3 spacebars@1.0.3
spiderable@1.0.4 spiderable@1.0.5
srp@1.0.1 srp@1.0.1
templating@1.0.8 templating@1.0.9
tracker@1.0.3 tracker@1.0.3
twitter@1.1.1 twitter@1.1.2
ui@1.0.4 ui@1.0.4
underscore@1.0.1 underscore@1.0.1
url@1.0.1 url@1.0.2
webapp-hashing@1.0.1 webapp-hashing@1.0.1
webapp@1.1.3 webapp@1.1.4

View File

@ -27,42 +27,43 @@ docController = RouteController.extend
loggedOutController = RouteController.extend loggedOutController = RouteController.extend
onBeforeAction: -> onBeforeAction: ->
if Meteor.user() then Router.go 'profile', user: Meteor.user().username if Meteor.user() then Router.go 'profile', user: Meteor.user().username
@next()
action: -> action: ->
@render() @render()
if Meteor.loggingIn() then @render 'spinner', to: 'outside' if Meteor.loggingIn() then @render 'spinner', to: 'outside'
loggedInController = RouteController.extend loggedInController = RouteController.extend
action: -> if !Meteor.user() then @render '404' else @render() action: -> if !Meteor.user() then @render '404' else @render()
Router.map -> Router.route '/',
@route 'home', name: 'home'
path: '/'
action: -> action: ->
if !@ready() then @render 'spinner', to: 'outside' if !@ready() then @render 'spinner', to: 'outside'
@render() @render('home')
@route 'doc', Router.route '/d/:_id',
path: '/d/:_id' name: 'doc'
controller: docController controller: docController
@route 'userDoc', Router.route '/@:user/:_id',
path: '/@:user/:_id' name: 'userDoc'
controller: docController controller: docController
@route 'src', Router.route '/src/:_id',
path:'/src/:_id' name: 'src'
controller: docController controller: docController
@route 'verify', Router.route '/verify/:token?',
path: '/verify/:token?' name: 'verify'
template: 'loading' template: 'loading'
onBeforeAction: -> onBeforeAction: ->
Accounts.verifyEmail @params.token, (err) -> Accounts.verifyEmail @params.token, (err) ->
if err then errCallback err if err then errCallback err
else Router.go 'profile', user: Meteor.user().username else Router.go 'profile', user: Meteor.user().username
@route 'edit', @next()
path: '/edit/:_id' Router.route '/edit/:_id',
name: 'edit'
template: 'editor' template: 'editor'
controller: loggedInController controller: loggedInController
waitOn: -> Meteor.subscribe 'doc', @params._id waitOn: -> Meteor.subscribe 'doc', @params._id
data: -> docs.findOne @params._id data: -> docs.findOne @params._id
@route 'profile', Router.route '/@:user',
path: '/@:user' name: 'profile'
waitOn: -> waitOn: ->
[Meteor.subscribe('docs', @params.user), [Meteor.subscribe('docs', @params.user),
Meteor.subscribe('user', @params.user)] Meteor.subscribe('user', @params.user)]
@ -72,12 +73,17 @@ Router.map ->
else if @ready() else if @ready()
if !@data() then @render '404' else @render() if !@data() then @render '404' else @render()
else @render 'loading' else @render 'loading'
@route 'new', template: 'editor' Router.route '/new',
@route 'signup', controller: loggedOutController name: 'new'
@route 'signin', template: 'editor'
path: 'login' Router.route '/signup',
name: 'signup'
controller: loggedOutController controller: loggedOutController
@route '404', path: '*' Router.route '/login',
name: 'signin'
template: 'signin'
controller: loggedOutController
Router.route '/(.*)', name: '404'
share.notify = notify = (opt) -> share.notify = notify = (opt) ->
if opt.type? then type = opt.type if opt.type? then type = opt.type
@ -92,8 +98,10 @@ errCallback = (err) ->
notify title: err.code or 'Error', msg: err.reason, type: 'error' notify title: err.code or 'Error', msg: err.reason, type: 'error'
else notify title: 'Error', msg: err, type: 'error' else notify title: 'Error', msg: err, type: 'error'
Template.magicIcon.notHome = -> Router.current().route.name isnt 'home' Template.magicIcon.helpers
Template.layout.showSpinner = -> Meteor.status().connected is yes notHome: -> Router.current().route.getName() isnt 'home'
Template.layout.helpers
showSpinner: -> Meteor.status().connected is yes
Template.home.events Template.home.events
'click #twitter-login': -> 'click #twitter-login': ->
if Meteor.user() then return notify msg: "You're already Logged In!" if Meteor.user() then return notify msg: "You're already Logged In!"
@ -102,8 +110,9 @@ Template.home.events
else else
Meteor.subscribe 'user' Meteor.subscribe 'user'
notify type: 'success', msg: 'Logged in' notify type: 'success', msg: 'Logged in'
Template.editor.isPublic = -> return "checked" if @public is yes Template.editor.helpers
Template.editor.showTitleChecked = -> return "checked" unless @showTitle is no isPublic: -> return "checked" if @public is yes
showTitleChecked: -> return "checked" unless @showTitle is no
Template.editor.events Template.editor.events
'click #upload': (e,t) -> 'click #upload': (e,t) ->
if Meteor.loggingIn() if Meteor.loggingIn()
@ -133,11 +142,10 @@ Template.editor.events
else notify type:'success', msg:'Document created successfully!' else notify type:'success', msg:'Document created successfully!'
if id then Router.go 'doc', _id: id if id then Router.go 'doc', _id: id
Template.profile.isMe = -> Template.profile.helpers
Meteor.user() and Meteor.user()._id is @_id isMe: -> Meteor.user() and Meteor.user()._id is @_id
Template.profile.noDocs = -> docs.find(owner: @_id).count() is 0 noDocs: -> docs.find(owner: @_id).count() is 0
Template.profile.documents = -> documents: -> docs.find {owner: @_id}, sort: dateCreated: -1
docs.find {owner: @_id}, sort: dateCreated: -1
Template.profile.events Template.profile.events
'click #resend': -> 'click #resend': ->
Meteor.call 'sendVerificationEmail', (e,r) -> Meteor.call 'sendVerificationEmail', (e,r) ->
@ -155,15 +163,15 @@ Template.profile.events
if e then errCallback e if e then errCallback e
else notify type: 'success', msg: 'Account deleted' else notify type: 'success', msg: 'Account deleted'
Template.doc.valid = -> @text? Template.doc.helpers
Template.doc.source = -> Router.current().route.name is 'src' valid: -> @text?
Template.doc.rows = -> ""+@text.split('\n').length source: -> Router.current().route.getName() is 'src'
Template.doc.owned = -> Meteor.user() and Meteor.user()._id is @owner rows: -> ""+@text.split('\n').length
Template.doc.privateUrl = -> owned: -> Meteor.user() and Meteor.user()._id is @owner
Template.doc.ownerName = -> ownerName: ->
if Router.current().route.name is 'userDoc' if Router.current().route.getName() is 'userDoc'
return Router.current().params.user return Router.current().params.user
Template.doc.expirationDays = -> expirationDays: ->
if @owner then return 'never' if @owner then return 'never'
else return moment.unix(@dateCreated).add(7,'days').fromNow() else return moment.unix(@dateCreated).add(7,'days').fromNow()
Template.doc.events Template.doc.events
@ -181,7 +189,7 @@ Template.doc.events
if err then errCallback err if err then errCallback err
else notify type:'success', msg:'Document removed' else notify type:'success', msg:'Document removed'
'click #src-doc': -> 'click #src-doc': ->
if Router.current().route.name is 'src' if Router.current().route.getName() is 'src'
Router.go 'doc', _id: @_id Router.go 'doc', _id: @_id
else Router.go 'src', _id: @_id else Router.go 'src', _id: @_id