mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 03:30:25 +00:00
fixed checkbox vote
This commit is contained in:
parent
3c4e7d082f
commit
1733bdd658
2 changed files with 10 additions and 6 deletions
|
|
@ -142,6 +142,10 @@ ready (model) ->
|
|||
|
||||
exports.vote = (e, el, next) ->
|
||||
direction = $(el).attr('data-direction')
|
||||
console.log direction
|
||||
direction = 'up' if direction == 'true/'
|
||||
direction = 'down' if direction == 'false/'
|
||||
|
||||
#TODO this should be model.at(el), shouldn't have to find parent
|
||||
task = model.at $(el).parents('li')[0]
|
||||
user = model.at '_user'
|
||||
|
|
@ -162,13 +166,13 @@ ready (model) ->
|
|||
adjustScore = false
|
||||
score += delta if adjustScore
|
||||
|
||||
# up/down -voting as checkbox & assigning as done, 2 birds one stone
|
||||
done = task.get("done")
|
||||
# up/down -voting as checkbox & assigning as completed, 2 birds one stone
|
||||
completed = task.get("completed")
|
||||
if task.get('type') != 'habit'
|
||||
done = true if direction=="up"
|
||||
done = false if direction=="down"
|
||||
completed = true if direction=="up"
|
||||
completed = false if direction=="down"
|
||||
task.set('score', score)
|
||||
task.set('done', done)
|
||||
task.set('completed', completed)
|
||||
|
||||
# Update the user's status
|
||||
[money, hp, exp, lvl] = [user.get('money'), user.get('hp'), user.get('exp'), user.get('lvl')]
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
<!-- Daily & Todos -->
|
||||
{else}
|
||||
<!--TODO this was part of input below <%= done ? "class='vote-down' checked='checked'" : "class='vote-up'" %>-->
|
||||
<input type="checkbox" checked={:task.completed} />
|
||||
<input type="checkbox" checked={:task.completed} x-bind=click:vote data-direction={:task.completed}/>
|
||||
{/}
|
||||
</div>
|
||||
<div class="task-text" x-bind=keydown:shortcuts contenteditable>{unescaped :task.text}</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue