mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-11 07:02:36 +01:00
Remove 'project_hidden' state
Compute it using project/context state Notable change: todo.hidden? now also returns true if the todo is completed
This commit is contained in:
parent
543f49ed8a
commit
ed3bca22a4
12 changed files with 66 additions and 106 deletions
|
|
@ -27,7 +27,7 @@ class Project < ActiveRecord::Base
|
|||
aasm :column => :state do
|
||||
|
||||
state :active, :initial => true
|
||||
state :hidden, :enter => :hide_todos, :exit => :unhide_todos
|
||||
state :hidden
|
||||
state :completed, :enter => :set_completed_at_date, :exit => :clear_completed_at_date
|
||||
|
||||
event :activate do
|
||||
|
|
@ -53,24 +53,6 @@ class Project < ActiveRecord::Base
|
|||
self.last_reviewed = Time.now
|
||||
end
|
||||
|
||||
def hide_todos
|
||||
todos.each do |t|
|
||||
unless t.completed? || t.deferred?
|
||||
t.hide!
|
||||
t.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unhide_todos
|
||||
todos.each do |t|
|
||||
if t.project_hidden?
|
||||
t.unhide!
|
||||
t.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_completed_at_date
|
||||
self.completed_at = Time.zone.now
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue