Collections now remain after refresh
This commit is contained in:
parent
11bb0daf89
commit
b1e1f6f96a
@ -12,3 +12,5 @@ less
|
||||
bootstrap-3
|
||||
iron-router
|
||||
bootstrap
|
||||
underscore
|
||||
amplify
|
||||
|
@ -2,19 +2,21 @@ Handlebars.registerHelper 'equals', (a, b) -> # equals operator was dropped in M
|
||||
a is b
|
||||
|
||||
# Allow access through all templates
|
||||
Handlebars.registerHelper "setInSession", (k, v) -> Session.set k, v
|
||||
Handlebars.registerHelper "getInSession", (k) -> Session.get k
|
||||
Handlebars.registerHelper "setInSession", (k, v) -> SessionAmplify.set k,v #Session.set k, v
|
||||
Handlebars.registerHelper "getInSession", (k) -> SessionAmplify.get k #Session.get k
|
||||
# Allow access throughout all coffeescript/js files
|
||||
@setInSession = (k, v) -> Session.set k, v
|
||||
@getInSession = (k) -> Session.get k
|
||||
@setInSession = (k, v) -> SessionAmplify.set k,v #Session.set k, v
|
||||
@getInSession = (k) -> SessionAmplify.get k
|
||||
|
||||
# retrieve account for selected user
|
||||
@getCurrentUserFromSession = ->
|
||||
Meteor.Users.findOne("userId": Session.get("userId"))
|
||||
Meteor.Users.findOne("userId": SessionAmplify.get("userId"))
|
||||
|
||||
# retrieve account for selected user
|
||||
Handlebars.registerHelper "getCurrentUser", =>
|
||||
@window.getCurrentUserFromSession()
|
||||
# @window.getCurrentUserFromSession()
|
||||
id = SessionAmplify.get("userId")
|
||||
Meteor.Users.findOne("userId": SessionAmplify.get("userId"))
|
||||
|
||||
# toggle state of field in the database
|
||||
@toggleCam = (event) ->
|
||||
@ -49,6 +51,7 @@ Handlebars.registerHelper "getCurrentUser", =>
|
||||
|
||||
Meteor.methods
|
||||
sendMeetingInfoToClient: (meetingId, userId) ->
|
||||
console.log "inside sendMeetingInfoToClient"
|
||||
Session.set("userId", userId)
|
||||
Session.set("meetingId", meetingId)
|
||||
Session.set("currentChatId", meetingId)
|
||||
@ -56,6 +59,13 @@ Meteor.methods
|
||||
Session.set("bbbServerVersion", "0.90")
|
||||
Session.set("userName", null)
|
||||
|
||||
SessionAmplify.set("userId", userId)
|
||||
SessionAmplify.set("meetingId", meetingId)
|
||||
SessionAmplify.set("currentChatId", meetingId)
|
||||
SessionAmplify.set("meetingName", null)
|
||||
SessionAmplify.set("bbbServerVersion", "0.90")
|
||||
SessionAmplify.set("userName", null)
|
||||
|
||||
@getUsersName = ->
|
||||
name = Session.get("userName") # check if we actually have one in the session
|
||||
if name? then name # great return it, no database query
|
||||
|
@ -1,5 +1,16 @@
|
||||
# These settings can just be stored locally in session, created at start up
|
||||
Meteor.startup ->
|
||||
console.log "inside startup"
|
||||
`this.SessionAmplify = _.extend({}, Session, {
|
||||
keys: _.object(_.map(amplify.store(), function(value, key) {
|
||||
return [key, JSON.stringify(value)]
|
||||
})),
|
||||
set: function (key, value) {
|
||||
Session.set.apply(this, arguments);
|
||||
amplify.store(key, value);
|
||||
},
|
||||
});`
|
||||
|
||||
Session.setDefault "display_usersList", true
|
||||
Session.setDefault "display_navbar", true
|
||||
Session.setDefault "display_chatbar", true
|
||||
@ -9,6 +20,15 @@ Meteor.startup ->
|
||||
Session.setDefault "joinedAt", getTime()
|
||||
Session.setDefault "isSharingAudio", false
|
||||
|
||||
SessionAmplify.set "display_usersList", true
|
||||
SessionAmplify.set "display_navbar", true
|
||||
SessionAmplify.set "display_chatbar", true
|
||||
SessionAmplify.set "display_whiteboard", false
|
||||
SessionAmplify.set "display_chatPane", true
|
||||
SessionAmplify.set 'inChatWith', "PUBLIC_CHAT"
|
||||
SessionAmplify.set "joinedAt", getTime()
|
||||
SessionAmplify.set "isSharingAudio", false
|
||||
|
||||
@myTabs = new WatchValue()
|
||||
@myTabs.updateValue [
|
||||
{isActive:true, name:"Public", class: "publicChatTab"}
|
||||
|
@ -5,11 +5,11 @@ Router.map ->
|
||||
path: "/meeting_id=*"
|
||||
action: () ->
|
||||
@redirect('/')
|
||||
Meteor.subscribe 'users', Session.get('meetingId')
|
||||
Meteor.subscribe 'chat', Session.get('meetingId')
|
||||
Meteor.subscribe 'shapes', Session.get('meetingId')
|
||||
Meteor.subscribe 'slides', Session.get('meetingId')
|
||||
Meteor.subscribe 'meetings', Session.get('meetingId')
|
||||
Meteor.subscribe 'users', getInSession('meetingId')
|
||||
Meteor.subscribe 'chat', getInSession('meetingId')
|
||||
Meteor.subscribe 'shapes', getInSession('meetingId')
|
||||
Meteor.subscribe 'slides', getInSession('meetingId')
|
||||
Meteor.subscribe 'meetings', getInSession('meetingId')
|
||||
|
||||
onBeforeAction: ()->
|
||||
url = location.href
|
||||
@ -36,6 +36,12 @@ Router.map ->
|
||||
console.log "unable to extract the required information for the meeting from the URL"
|
||||
@route "main",
|
||||
path: "/"
|
||||
onBeforeAction: ->
|
||||
Meteor.subscribe 'users', getInSession('meetingId')
|
||||
Meteor.subscribe 'chat', getInSession('meetingId')
|
||||
Meteor.subscribe 'shapes', getInSession('meetingId')
|
||||
Meteor.subscribe 'slides', getInSession('meetingId')
|
||||
Meteor.subscribe 'meetings', getInSession('meetingId')
|
||||
|
||||
@route "logout",
|
||||
path: "logout"
|
||||
|
Loading…
Reference in New Issue
Block a user