challenges: lock down editing capabilities on certain task properties,

instead showing the challenge's properties (in case they change
challenge-side).This includes editing the tag name
This commit is contained in:
Tyler Renelle
2013-05-28 11:52:32 +01:00
parent 2666ebb1fc
commit 2fbff2a0bc
5 changed files with 56 additions and 19 deletions
+18 -1
View File
@@ -101,4 +101,21 @@ module.exports.viewHelpers = (view) ->
#Tags
view.fn 'noTags', helpers.noTags
view.fn 'appliedTags', helpers.appliedTags
view.fn 'appliedTags', helpers.appliedTags
#Challenges
view.fn 'taskAttrFromChallenge', (task, attr) ->
[tid, gid, cid, tType, gType] = [task.id, task.group.id, task.challenge, task.type, task.group.type]
findAttr = (challenges) ->
challenge = _.find(challenges,{id:cid})
val = _.find(challenge["#{tType}s"],{id:tid})[attr]
if attr is 'priority'
val = switch val
when '!!!' then 'Hard'
when '!!' then 'Medium'
else 'Easy'
return val
if gType is 'party'
findAttr @model.get("_party.challenges")
else if gType is 'guild'
findAttr _.find(@model.get("_guilds"),{id:gid}).challenges