forked from xgrommx/vizor-create
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow user: List of users in People tab, click to follow user, click…
… again to unfollow Other changes: - add E2.app.growl() method for showing messages - stop handling ctrl/cmd-l - add userId to session cookie - make the server know about active graph, followers
- Loading branch information
Showing
18 changed files
with
505 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
function PeopleManager(peopleStore, $el) { | ||
var that = this | ||
|
||
this.peopleStore = peopleStore | ||
this.$el = $el | ||
this._template = E2.views.partials.peopleMenu | ||
|
||
this.peopleStore.on('added', this.render.bind(this)) | ||
this.peopleStore.on('removed', this.render.bind(this)) | ||
this.peopleStore.on('userUnfollowed', function(person, followee) { | ||
if (followee.uid === E2.app.channel.uid) | ||
E2.app.growl(person.username+' stopped following you') | ||
|
||
that.render() | ||
}) | ||
this.peopleStore.on('userFollowed', function(person, followee) { | ||
if (followee.uid === E2.app.channel.uid) | ||
E2.app.growl(person.username+' started following you') | ||
|
||
that.render() | ||
}) | ||
} | ||
|
||
PeopleManager.prototype.render = function() { | ||
var that = this | ||
|
||
var people = this.peopleStore.list().map(function(p) { | ||
p.followed = (p.uid === that.peopleStore.me.followUid) | ||
|
||
if (p.uid === E2.app.channel.uid) | ||
p.itsMe = true | ||
|
||
return p | ||
}) | ||
|
||
var html = this._template({ people: people }) | ||
|
||
this.$el.empty().html(html) | ||
|
||
this.$el.find('li').click(function(e) { | ||
var $t = $(e.target).closest('li') | ||
var uid = $t.data('uid') | ||
|
||
if (that.peopleStore.me.followUid === uid) { | ||
E2.app.dispatcher.dispatch({ | ||
actionType: 'uiUserIdUnfollowed', | ||
followUid: uid | ||
}) | ||
} else { | ||
if (uid === E2.app.channel.uid) | ||
return; | ||
|
||
E2.app.dispatcher.dispatch({ | ||
actionType: 'uiUserIdFollowed', | ||
followUid: uid | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.