convert armor model.fn to a view.fn, so we can use on party too
This commit is contained in:
+13
-1
@@ -54,4 +54,16 @@ module.exports.viewHelpers = (view) ->
|
||||
a < b
|
||||
|
||||
view.fn "tokens", (money) ->
|
||||
return money/0.25
|
||||
return money/0.25
|
||||
|
||||
view.fn 'currentArmor', (user) ->
|
||||
console.log user
|
||||
[gender, armor, armorSet] = [user.preferences.gender, user.items.armor, user.preferences.armorSet]
|
||||
if gender == 'f'
|
||||
str = "armor#{armor}_f"
|
||||
if parseInt(armor) > 1
|
||||
armorSet = if armorSet then armorSet else 'v1'
|
||||
str += '_' + armorSet
|
||||
return "#{str}.png"
|
||||
else
|
||||
return "armor#{armor}_m.png"
|
||||
@@ -24,16 +24,6 @@ setupModelFns = (model) ->
|
||||
# also update in scoring.coffee. TODO create a function accessible in both locations
|
||||
(lvl*100)/5
|
||||
|
||||
model.fn '_user._armor', '_user.items.armor', '_user.preferences.armorSet', '_user.preferences.gender', (armor, armorSet, gender) ->
|
||||
if gender == 'f'
|
||||
str = "armor#{armor}_f"
|
||||
if parseInt(armor) > 1
|
||||
armorSet = if armorSet then armorSet else 'v1'
|
||||
str += '_' + armorSet
|
||||
return "#{str}.png"
|
||||
else
|
||||
"armor#{armor}_m.png"
|
||||
|
||||
# model.fn '_user._friends', '_user.friends', (friendIds) ->
|
||||
# model.fetch model.query('users').friends(friendIds), (err, friends) ->
|
||||
# model.set '_view.friends', friends
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = (store) ->
|
||||
###
|
||||
store.query.expose "users", "friends", (ids) ->
|
||||
@where("id").within(ids)
|
||||
.only('stats', 'items', 'auth.local.username', 'auth.facebook.displayName')
|
||||
.only('stats', 'preferences.gender', 'preferences.armorSet', 'items', 'auth.local.username', 'auth.facebook.displayName')
|
||||
|
||||
store.queryAccess "users", "friends", (ids, next) ->
|
||||
next(true) # no harm in public user stats
|
||||
|
||||
Reference in New Issue
Block a user