channels list

pull/118/head
Diego Sampaio 10 years ago
parent b3d8399e2f
commit e64327e624
  1. 9
      client/views/app/sideNav/channels.coffee
  2. 2
      client/views/app/sideNav/channels.html
  3. 6
      client/views/app/sideNav/createChannelFlex.coffee
  4. 6
      client/views/app/sideNav/createChannelFlex.html
  5. 12
      client/views/app/sideNav/listChannelsFlex.coffee
  6. 13
      client/views/app/sideNav/listChannelsFlex.html
  7. 3
      i18n/en.i18n.json
  8. 3
      server/methods/channelsList.coffee
  9. 2
      server/methods/hideRoom.coffee
  10. 2
      server/publications.coffee

@ -9,10 +9,9 @@ Template.channels.helpers
Template.channels.events
'click .add-room': (e, instance) ->
SideNav.setFlex "channelsFlex"
SideNav.setFlex "createChannelFlex"
SideNav.openFlex()
# $('.channel-flex').removeClass('_hidden')
# instance.clearForm()
# $('#channel-name').focus()
Template.channels.onCreated ->
'click .more-channels': ->
SideNav.setFlex "listChannelsFlex"
SideNav.openFlex()

@ -12,4 +12,6 @@
{{else}}
<p class="empty">{{_ "chatRooms.No_channels_yet" }}</p>
{{/if}}
<p><a class="more-channels">{{_ "chatRooms.More_channels"}}</a></p>
</template>

@ -1,4 +1,4 @@
Template.channelsFlex.helpers
Template.createChannelFlex.helpers
selectedUsers: ->
return Template.instance().selectedUsers.get()
@ -32,7 +32,7 @@ Template.channelsFlex.helpers
]
}
Template.channelsFlex.events
Template.createChannelFlex.events
'autocompleteselect #channel-members': (event, instance, doc) ->
instance.selectedUsers.set instance.selectedUsers.get().concat doc._id
@ -73,7 +73,7 @@ Template.channelsFlex.events
else
Template.instance().error.set(err)
Template.channelsFlex.onCreated ->
Template.createChannelFlex.onCreated ->
instance = this
instance.selectedUsers = new ReactiveVar []
instance.selectedUserNames = {}

@ -1,7 +1,7 @@
<template name="channelsFlex">
<template name="createChannelFlex">
<header>
<h4>{{_ "chatRooms.Channels"}}</h4>
<p>Create a new channel</p>
<p>{{_ "chatRooms.Create_new_channel" }}</p>
</header>
<div class="content">
<div class="input-line">
@ -30,4 +30,4 @@
<button class="button clean cancel-channel">{{_ "chatRooms.Cancel" }}</button>
</div>
</div>
</template>
</template>

@ -0,0 +1,12 @@
Template.listChannelsFlex.helpers
channel: ->
return Template.instance().channelsList?.get()
Template.listChannelsFlex.onRendered ->
instance = this
instance.channelsList = new ReactiveVar []
Meteor.call 'channelsList', (err, result) ->
if result
instance.channelsList.set result.channels

@ -0,0 +1,13 @@
<template name="listChannelsFlex">
<header>
<h4>{{_ "chatRooms.Channels"}}</h4>
</header>
<div class="content">
<ul>
{{#each channel}}
<li><a href="{{pathFor "room"}}">{{name}}</a></li>
{{/each}}
</ul>
</div>
</template>

@ -34,7 +34,8 @@
"No_channels_yet": "You aren't part of any channel yet.",
"No_direct_messages_yet": "You haven't started any conversations yet.",
"No_groups_yet": "You have no private groups yet.",
"No_favorites_yet": "You haven't added any favorites yet."
"No_favorites_yet": "You haven't added any favorites yet.",
"Create_new_channel": "Create a new channel"
},
"chatWindowDashboard": {
"Add_users": "Add users",

@ -0,0 +1,3 @@
Meteor.methods
channelsList: ->
return ChatSubscription.find({ uid: Meteor.userId(), t: 'c' }).fetch()

@ -6,4 +6,4 @@ Meteor.methods
unless Meteor.userId()?
throw new Meteor.Error 300, 'Usuário não logado'
ChatSubscription.update({ rid: roomId, uid: Meteor.userId() }, { $unset: { ts: 1, f: 1 } })
ChatSubscription.update({ rid: roomId, uid: Meteor.userId() }, { $set: { hide: true } })

@ -29,7 +29,7 @@ Meteor.publish 'myRoomActivity', ->
return Meteor.publishWithRelations
handle: this
collection: ChatSubscription
filter: { uid: this.userId, $or: [ { ts: { $gte: moment().subtract(1, 'days').startOf('day').toDate() } }, { f: true } ] }
filter: { uid: this.userId, hide: { $ne: true } }
mappings: [
key: 'rid'
reverse: false

Loading…
Cancel
Save