cleanup of the show-completed / show-remaining. That context-dependant
/ display-context-for stuff was bugging me out, and wasn't using Derby to it's potential. also some tags & habit-wide cleanup in helpers:taskClasses()
This commit is contained in:
@@ -125,14 +125,17 @@ viewHelpers = (view) ->
|
||||
###
|
||||
Tasks
|
||||
###
|
||||
view.fn 'taskClasses', (task, filters, dayStart, lastCron) ->
|
||||
view.fn 'taskClasses', (task, filters, dayStart, lastCron, showCompleted=false) ->
|
||||
return unless task
|
||||
{type, completed, value, repeat} = task
|
||||
|
||||
# completed / remaining toggle
|
||||
return 'hidden' if (type is 'todo') and (completed != showCompleted)
|
||||
|
||||
for filter, enabled of filters
|
||||
if enabled and not task.tags?[filter]
|
||||
# All the other classes don't matter
|
||||
return 'hide'
|
||||
return 'hidden'
|
||||
|
||||
classes = type
|
||||
|
||||
@@ -150,6 +153,8 @@ viewHelpers = (view) ->
|
||||
classes += " completed"
|
||||
else
|
||||
classes += " uncompleted"
|
||||
else if type is 'habit'
|
||||
classes += ' habit-wide' if task.down and task.up
|
||||
|
||||
if value < -20
|
||||
classes += ' color-worst'
|
||||
|
||||
+2
-22
@@ -99,28 +99,8 @@ module.exports.app = (appExports, model) ->
|
||||
chart = new google.visualization.LineChart(document.getElementById( chartSelector ))
|
||||
chart.draw(data, options)
|
||||
|
||||
appExports.changeContext = (e, el) ->
|
||||
# Get the data from the element
|
||||
targetSelector = $(el).attr('data-target')
|
||||
newContext = $(el).attr('data-context')
|
||||
newActiveNav = $(el).parent('li')
|
||||
|
||||
# If the clicked nav is already active, do nothing
|
||||
if newActiveNav.hasClass('active')
|
||||
return
|
||||
|
||||
# Find the old active nav and context
|
||||
oldActiveNav = $(el).closest('ul').find('> .active')
|
||||
oldContext = oldActiveNav.find('a').attr('data-context')
|
||||
|
||||
# Set the new active nav
|
||||
oldActiveNav.removeClass('active')
|
||||
newActiveNav.addClass('active')
|
||||
|
||||
# Set the new context on the target
|
||||
target = $(targetSelector)
|
||||
target.removeClass(oldContext)
|
||||
target.addClass(newContext)
|
||||
appExports.todosShowRemaining = -> model.set '_showCompleted', false
|
||||
appExports.todosShowCompleted = -> model.set '_showCompleted', true
|
||||
|
||||
setUndo = (stats, task) ->
|
||||
previousUndo = model.get('_undo')
|
||||
|
||||
Reference in New Issue
Block a user