mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 17:20:12 +01:00
added separate database field for reviews
This commit is contained in:
parent
7ebf25320b
commit
77b6c931ca
5 changed files with 40 additions and 7 deletions
|
|
@ -52,15 +52,15 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_reviewed
|
def set_reviewed
|
||||||
template = 'projects/update.js.erb'
|
|
||||||
|
|
||||||
#@source_view = 'project'
|
#@source_view = 'project'
|
||||||
@project = current_user.projects.find(params[:id])
|
@project = current_user.projects.find(params[:id])
|
||||||
|
@project.last_reviewed = Time.now
|
||||||
|
@project.save
|
||||||
|
|
||||||
@project.todos.each do |todo|
|
# @project.todos.each do |todo|
|
||||||
todo.created_at = Time.now
|
# todo.created_at = Time.now
|
||||||
todo.save
|
# todo.save
|
||||||
end
|
# end
|
||||||
|
|
||||||
redirect_to :action => 'show'
|
redirect_to :action => 'show'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,20 @@ module ProjectsHelper
|
||||||
project_description
|
project_description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def needsreview_class(item)
|
||||||
|
# if item.due || item.completed?
|
||||||
|
# return ""
|
||||||
|
# elsif item.last_reviewed < current_user.time - (prefs.staleness_starts * 3).days
|
||||||
|
# return " stale_l3"
|
||||||
|
# elsif item.last_reviewed < current_user.time - (prefs.staleness_starts * 2).days
|
||||||
|
# return " stale_l2"
|
||||||
|
# elsif
|
||||||
|
if item.last_reviewed < current_user.time - (prefs.staleness_starts).days
|
||||||
|
return "needsreview"
|
||||||
|
else
|
||||||
|
return "needsnoreview"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,12 @@ suppress_edit_button ||= false
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
||||||
<div class="data">
|
<div class="data">
|
||||||
<%= link_to_project( project ) %><%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %>
|
<span class="<%= needsreview_class( project ) %>">
|
||||||
|
<%= link_to_project( project ) %>
|
||||||
|
</span>
|
||||||
|
<%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddLastReviewedToProject < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :projects, :last_reviewed, :timestamp
|
||||||
|
execute 'update projects set last_reviewed = created_at where last_reviewed IS NULL'
|
||||||
|
end
|
||||||
|
def self.down
|
||||||
|
remove_column :projects, :last_reviewed
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
.needsreview {
|
||||||
|
background: #ffC;
|
||||||
|
}
|
||||||
|
|
||||||
.widgets a.reviewed, button.reviewed{
|
.widgets a.reviewed, button.reviewed{
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue