Adding first rudimentary version of tagging and filtering. New users get three tags: morning, afternoon and evening. At the moment, one can not change these tags or add new ones. There are also some problems: tagging a newly added task, also tags one of the existing tasks. Also, when having an active filter and removing the corresponding tag from a task, that task is immediately hidden, although you are still editing it.
This commit is contained in:
@@ -111,6 +111,7 @@ userSchema =
|
||||
flags:
|
||||
partyEnabled: false
|
||||
itemsEnabled: false
|
||||
tags: []
|
||||
# ads: 'show' # added on registration
|
||||
|
||||
module.exports.newUserObject = ->
|
||||
@@ -130,6 +131,12 @@ module.exports.newUserObject = ->
|
||||
{type: 'reward', text: 'Cake', notes: 'But only buy if you have enough gold - you lose HP otherwise.', value: 10 }
|
||||
]
|
||||
|
||||
defaultTags = [
|
||||
{name: 'morning'}
|
||||
{name: 'afternoon'}
|
||||
{name: 'evening'}
|
||||
]
|
||||
|
||||
for task in defaultTasks
|
||||
guid = task.id = derby.uuid()
|
||||
newUser.tasks[guid] = task
|
||||
@@ -138,6 +145,11 @@ module.exports.newUserObject = ->
|
||||
when 'daily' then newUser.dailyIds.push guid
|
||||
when 'todo' then newUser.todoIds.push guid
|
||||
when 'reward' then newUser.rewardIds.push guid
|
||||
|
||||
for tag in defaultTags
|
||||
tag.id = derby.uuid()
|
||||
newUser.tags.push tag
|
||||
|
||||
return newUser
|
||||
|
||||
module.exports.updateUser = (model) ->
|
||||
|
||||
Reference in New Issue
Block a user