Just pass in task object to taskClasses view helper

This commit is contained in:
Tyler Renelle 2012-09-29 18:03:47 -04:00
parent 38e1a95140
commit d04140977f
3 changed files with 6 additions and 5 deletions

View file

@ -19,8 +19,9 @@ module.exports.dayMapping = dayMapping = {
};
module.exports.viewHelpers = function(view) {
view.fn('taskClasses', function(type, completed, value, repeat) {
var classes;
view.fn('taskClasses', function(task) {
var classes, completed, repeat, type, value;
type = task.type, completed = task.completed, value = task.value, repeat = task.repeat;
classes = type;
if (completed || (repeat && repeat[dayMapping[moment().day()]] === false)) {
classes += " completed";

View file

@ -7,8 +7,8 @@ module.exports.daysBetween = (a, b) ->
module.exports.dayMapping = dayMapping = {0:'su',1:'m',2:'t',3:'w',4:'th',5:'f',6:'s',7:'su'}
module.exports.viewHelpers = (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

View file

@ -271,7 +271,7 @@
</form>
<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)}">
<pre>
<div class="task-meta-controls">