Skip to content

Commit

Permalink
Merge branch 'feature/user-accounts' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
zuohaisu committed Jun 30, 2014
2 parents 8f22dde + 37b5f6c commit 798f1ff
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion both/config/development.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"public": {
"rails_server": "http://localhost:3000"
"rails_server": "http://localhost:3000",
"customers_inc": 15,
"messages_inc": 15
}
}
6 changes: 3 additions & 3 deletions both/controllers/staffs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Staffs.chat = AppController.extend({
return {limit: Session.get('customersLimit')};
}
else {
Session.set('customersLimit', 15);
Session.set('customersLimit', Meteor.settings.public.customers_inc);
return {limit: Session.get('customersLimit')};
}
},
Expand All @@ -17,7 +17,7 @@ Staffs.chat = AppController.extend({
};
}
else {
Session.set(messagesLimit, 15)
Session.set(messagesLimit, Meteor.settings.public.messages_inc)
return {
sort: {created_at: -1},
limit: Session.get(messagesLimit)
Expand All @@ -28,7 +28,7 @@ Staffs.chat = AppController.extend({
currentUserId = Meteor.userId();
return [
Meteor.subscribe('staffs'),
Meteor.subscribe('accounts'),
Meteor.subscribe('accounts', Meteor.userId()),
Meteor.subscribe('customers', Session.get('accountSelected'), this.customersOption()),
Meteor.subscribe('messages', Session.get('customerSelected'), this.messagesOption())
];
Expand Down
3 changes: 2 additions & 1 deletion client/components/header/header.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
############################
Template.accountList.helpers
accounts: ->
db.accounts.find()
db.accounts.find(user_id: Meteor.userId())

Template.accountList.events
'click li': (e) ->
Expand Down Expand Up @@ -51,6 +51,7 @@ Template.accountModal.events
name: document.getElementById('account_name').value
app_id: document.getElementById('app_id').value
app_secret: document.getElementById('app_secret').value
user_id: Meteor.userId()
headers:
'Content-Type': 'application/x-www-form-urlencoded'
(error, result) -> console.log result
Expand Down
4 changes: 2 additions & 2 deletions client/pages/staffs/chat.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Template.chat.events
'click .more-customers': (e) ->
e.preventDefault

increment = 15
increment = Meteor.settings.public.customers_inc
if Session.get('customersLimit')
limit = Session.get('customersLimit') + increment
Session.set('customersLimit', limit)
Expand All @@ -122,7 +122,7 @@ Template.chat.events
'click .more-messages': (e) ->
e.preventDefault

increment = 15
increment = Meteor.settings.public.messages_inc
messagesLimit = Session.get('customerSelected') + 'msgsLimit'
if Session.get(messagesLimit)
limit = Session.get(messagesLimit) + increment
Expand Down
4 changes: 2 additions & 2 deletions server/publications/accounts.coffee
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Meteor.publish 'accounts', ->
db.accounts.find()
Meteor.publish 'accounts', (userId)->
db.accounts.find(user_id: userId)

0 comments on commit 798f1ff

Please sign in to comment.