mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 15:09:32 +00:00
pass in whole task object to taskClasses
This commit is contained in:
parent
10e9d3eb40
commit
903745f7c9
2 changed files with 9 additions and 7 deletions
|
|
@ -5,15 +5,17 @@ moment = require 'moment'
|
|||
character = require './character'
|
||||
|
||||
module.exports.view = (view) ->
|
||||
view.fn 'taskClasses', (type, completed, value, repeat) ->
|
||||
#TODO figure out how to just pass in the task model, so i can access all these properties from one object
|
||||
view.fn 'taskClasses', (task) ->
|
||||
{type, completed, value, repeat} = task
|
||||
|
||||
classes = type
|
||||
|
||||
# show as completed if completed (naturally) or not required for today
|
||||
if completed or (repeat and repeat[helpers.dayMapping[moment().day()]]==false)
|
||||
classes += " completed"
|
||||
else
|
||||
classes += " uncompleted"
|
||||
if type in ['todo', 'daily']
|
||||
if completed or (repeat and repeat[helpers.dayMapping[moment().day()]]==false)
|
||||
classes += " completed"
|
||||
else
|
||||
classes += " uncompleted"
|
||||
|
||||
if value < -20
|
||||
classes += ' color-worst'
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@
|
|||
|
||||
<!-- all the parts of a single task -->
|
||||
<task:>
|
||||
<li data-id={{:task.id}} class="task {taskClasses(:task.type, :task.completed, :task.value, :task.repeat)}">
|
||||
<li data-id={{:task.id}} class="task {taskClasses(:task)}">
|
||||
|
||||
<!-- right-hand side control buttons -->
|
||||
<div class="task-meta-controls">
|
||||
|
|
|
|||
Loading…
Reference in a new issue