Add latest achievements to clan details page

This commit is contained in:
Matt Lott 2015-04-06 10:19:35 -07:00
parent d4aa9882a9
commit 7f0e9e73a8
2 changed files with 6 additions and 0 deletions

View file

@ -50,6 +50,7 @@ block content
td Name td Name
th Level th Level
th Achievements th Achievements
th Latest Achievement
th th
tbody tbody
each member in members each member in members
@ -65,6 +66,9 @@ block content
td td
if memberAchievementsMap && memberAchievementsMap[member.id] if memberAchievementsMap && memberAchievementsMap[member.id]
| #{memberAchievementsMap[member.id].length} | #{memberAchievementsMap[member.id].length}
td
if memberAchievementsMap && memberAchievementsMap[member.id] && memberAchievementsMap[member.id].length
span= memberAchievementsMap[member.id][0].get('achievementName')
td td
if isOwner && member.id !== clan.get('ownerID') if isOwner && member.id !== clan.get('ownerID')
button.btn.btn-xs.btn-warning.remove-member-btn(data-id="#{member.id}") Remove Hero button.btn.btn-xs.btn-warning.remove-member-btn(data-id="#{member.id}") Remove Hero

View file

@ -98,6 +98,8 @@ module.exports = class ClanDetailsView extends RootView
user = achievement.get('user') user = achievement.get('user')
@memberAchievementsMap[user] ?= [] @memberAchievementsMap[user] ?= []
@memberAchievementsMap[user].push achievement @memberAchievementsMap[user].push achievement
for user of @memberAchievementsMap
@memberAchievementsMap[user].sort (a, b) -> b.id.localeCompare(a.id)
@render?() @render?()
onMemberSessionsSync: -> onMemberSessionsSync: ->