Trying to fix up, still a big mess

This commit is contained in:
perroned 2014-07-10 07:36:29 -07:00
parent 4001373438
commit 239666d2ef
3 changed files with 12 additions and 18 deletions

View File

@ -2,7 +2,7 @@
position:absolute;
right: 0;
top: 65px;
width:20%;
width:30%;
background: #fff;
/*z-index: @z-index-chat;*/
overflow: hidden;

View File

@ -43,19 +43,18 @@ Template.tabButtons.events
Meteor.call 'invalidateAllTabs', Session.get('userId'), false
console.log @name
toUpdate = Meteor.ChatTabs.findOne({name:@name})
Meteor.ChatTabs.update({_id: toUpdate._id}, {$set: 'isActive':true})
if toUpdate? then Meteor.ChatTabs.update({_id: toUpdate._id}, {$set: 'isActive':true})
'click .close': (event) -> # user closes private chat
toRemove = Meteor.ChatTabs.findOne({name:@name})
if toRemove then Meteor.ChatTabs.remove({_id: toRemove._id}) # should probably delete chat history here too?
Session.set 'inChatWith', "PUBLIC_CHAT" # switch over to public chat
Meteor.call 'invalidateAllTabs', Session.get('userId'), true
# only set public active if they click to remove whats being viewed
# if $(event.target.parentElement.parentElement).hasClass('active')
# $(".publicChatTab").addClass("active")
# # # safety checking, make public active by default if nothing is active
# if not $('.tab').hasClass('active') then $(".publicChatTab").addClass("active")
if toRemove? then Meteor.ChatTabs.remove({_id: toRemove._id}) # should probably delete chat history here too?
Session.set 'display_chatPane', true
Session.set 'inChatWith', 'PUBLIC_CHAT'
Meteor.call 'invalidateAllTabs', Session.get('userId'), false
toUpdate = Meteor.ChatTabs.findOne({name:"Public"})
Meteor.ChatTabs.update({_id: toUpdate._id}, {$set: 'isActive':true})
event.stopPropogation()
Template.chatInput.events
@ -107,6 +106,7 @@ Template.optionsBar.events
Meteor.ChatTabs.insert({belongsTo: currUserId, name: @user.name, isActive: true, class: "privateChatTab", 'userId': @userId})
# Give tab to recipient to notify them
Meteor.ChatTabs.insert({belongsTo: @userId, name: getUsersName(), isActive: false, class: "privateChatTab", 'userId': currUserId})
Session.set 'display_chatPane', true
Session.set "inChatWith", @userId
# $('.tab').removeClass('active')
# Todo:
@ -131,12 +131,6 @@ Template.tabButtons.helpers
button += 'class="'
button += 'active ' if @isActive
button += "#{@class} tab\"><a href=\"#\" data-toggle=\"tab\">#{@name}"
if @isActive
button += "(active)"
else
button += "(not active)"
button += '&nbsp;<button class="close closeTab" type="button" >×</button>' if @name isnt 'Public' and @name isnt 'Options'
button += '</a></li>'
console.log "and here it is the button"

View File

@ -27,5 +27,5 @@ Meteor.methods
if setFirst # able to specify the first to be active
console.log "setting first tab as active"
firstRecord = Meteor.ChatTabs.findOne({'belongsTo':userId})
firstRecord = Meteor.ChatTabs.findOne({'belongsTo':userId, name:"Public"})
Meteor.ChatTabs.update({_id: firstRecord._id}, {$set: isActive:true})