mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
first version of review view
This commit is contained in:
parent
5f0bcebca9
commit
ac98737176
8 changed files with 82 additions and 5 deletions
|
|
@ -34,7 +34,40 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def review
|
def review
|
||||||
puts "MUAUAUAUAUAUAUAUA"
|
## select project that need reviewing
|
||||||
|
@projects_to_review = Array.new
|
||||||
|
current_user.projects.each do |project|
|
||||||
|
@projects_to_review.push project if project.needs_review?(current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
## select project that are stalled
|
||||||
|
@stalled_projects = Array.new
|
||||||
|
current_user.projects.each do |project|
|
||||||
|
@stalled_projects.push project if project.stalled?
|
||||||
|
end
|
||||||
|
|
||||||
|
## select project that are stalled
|
||||||
|
@blocked_projects = Array.new
|
||||||
|
current_user.projects.each do |project|
|
||||||
|
@blocked_projects.push project if project.blocked?
|
||||||
|
end
|
||||||
|
|
||||||
|
@contexts = current_user.contexts.all
|
||||||
|
init_not_done_counts(['project'])
|
||||||
|
init_project_hidden_todo_counts(['project'])
|
||||||
|
if params[:only_active_with_no_next_actions]
|
||||||
|
@projects = current_user.projects.active.select { |p| count_undone_todos(p) == 0 }
|
||||||
|
else
|
||||||
|
@projects = current_user.projects.all
|
||||||
|
end
|
||||||
|
|
||||||
|
@page_title = t('projects.list_reviews')
|
||||||
|
@count = @projects_to_review.count + @blocked_projects.count + @stalled_projects.count
|
||||||
|
|
||||||
|
@no_projects = current_user.projects.empty?
|
||||||
|
current_user.projects.cache_note_counts
|
||||||
|
@new_project = current_user.projects.build
|
||||||
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
def done
|
def done
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ module ProjectsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def needsreview_class(item)
|
def needsreview_class(item)
|
||||||
### FIXME: need to check to do this with active projects only
|
raise "item must be a Project " unless item.kind_of? Project
|
||||||
|
|
||||||
if item.needs_review?(current_user)
|
if item.needs_review?(current_user)
|
||||||
return "needsreview"
|
return "needsreview"
|
||||||
else
|
else
|
||||||
|
|
@ -76,5 +77,4 @@ module ProjectsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,28 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs_review?(current_user)
|
def needs_review?(current_user)
|
||||||
return (last_reviewed < current_user.time ) # - current_user.prefs.review_period.days)
|
return false unless !nil?
|
||||||
|
return true if last_reviewed.nil?
|
||||||
|
return (active? && (last_reviewed < current_user.time - current_user.prefs.review_period.days))
|
||||||
|
end
|
||||||
|
|
||||||
|
def blocked?
|
||||||
|
## mutually exclusive for stalled and blocked
|
||||||
|
return false if stalled?
|
||||||
|
is_blocked = true
|
||||||
|
todos.each do |t|
|
||||||
|
is_blocked = false if (!t.completed? && !t.deferred? && !t.pending?)
|
||||||
|
end
|
||||||
|
return is_blocked
|
||||||
|
end
|
||||||
|
|
||||||
|
def stalled?
|
||||||
|
return true if todos.count == 0
|
||||||
|
is_stalled = true
|
||||||
|
todos.each do |t|
|
||||||
|
is_stalled = false if (!t.completed?)
|
||||||
|
end
|
||||||
|
return is_stalled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><%= navigation_link( t('common.contexts'), contexts_path, {:accesskey=>"c", :title=>t('layouts.navigation.contexts_title')} ) %></li>
|
<li><%= navigation_link( t('common.contexts'), contexts_path, {:accesskey=>"c", :title=>t('layouts.navigation.contexts_title')} ) %></li>
|
||||||
<li><%= navigation_link( t('common.notes'), notes_path, {:accesskey => "o", :title => t('layouts.navigation.notes_title')} ) %></li>
|
<li><%= navigation_link( t('common.notes'), notes_path, {:accesskey => "o", :title => t('layouts.navigation.notes_title')} ) %></li>
|
||||||
|
<li><%= navigation_link( t('common.review'), review_path, {:accesskey => "r", :title => t('layouts.navigation.review_title')} ) %></li>
|
||||||
<li><%= navigation_link( t('layouts.navigation.recurring_todos'), {:controller => "recurring_todos", :action => "index"}, :title => t('layouts.navigation.recurring_todos_title')) %></li>
|
<li><%= navigation_link( t('layouts.navigation.recurring_todos'), {:controller => "recurring_todos", :action => "index"}, :title => t('layouts.navigation.recurring_todos_title')) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@
|
||||||
<div class="project-state-group" id="list-<%= state %>-projects-container" <%= " style=\"display:none\"" if project_state_group.empty? %>>
|
<div class="project-state-group" id="list-<%= state %>-projects-container" <%= " style=\"display:none\"" if project_state_group.empty? %>>
|
||||||
<h2>
|
<h2>
|
||||||
<span id="<%= state %>-projects-count" class="badge"><%= project_state_group.length%><%= total_count_string%></span>
|
<span id="<%= state %>-projects-count" class="badge"><%= project_state_group.length%><%= total_count_string%></span>
|
||||||
<%= t('common.last' )%> <%= t('states.'+state+'_plural' )%> <%= t('common.projects') %><%= total_count==-1 ? "" : " ("+link_to("Show all", done_projects_path)+")"%>
|
|
||||||
|
<%= t('common.last' ) unless (state == 'review' || state == 'stalled' || state == 'blocked')%>
|
||||||
|
<%= t('states.'+state+'_plural' )%>
|
||||||
|
<%= t('common.projects') %><%= total_count==-1 ? "" : " ("+link_to("Show all", done_projects_path)+")"%>
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
<div class="menu_sort"><span class="sort_separator"><%= t('common.sort.sort') %> </span>
|
<div class="menu_sort"><span class="sort_separator"><%= t('common.sort.sort') %> </span>
|
||||||
<div class="alpha_sort">
|
<div class="alpha_sort">
|
||||||
|
|
|
||||||
6
app/views/projects/review.html.erb
Normal file
6
app/views/projects/review.html.erb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div id="projects-empty-nd" style="<%= @no_projects ? 'display:block' : 'display:none'%>">
|
||||||
|
<div class="message"><p><%= t('projects.no_projects') %></p></div>
|
||||||
|
</div>
|
||||||
|
<%= render :partial => 'project_state_group', :object => @projects_to_review, :locals => { :state => 'review'} %>
|
||||||
|
<%= render :partial => 'project_state_group', :object => @stalled_projects, :locals => { :state => 'stalled'} %>
|
||||||
|
<%= render :partial => 'project_state_group', :object => @blocked_projects, :locals => { :state => 'blocked'} %>
|
||||||
|
|
@ -22,6 +22,7 @@ en:
|
||||||
feeds: Feeds
|
feeds: Feeds
|
||||||
starred: Starred
|
starred: Starred
|
||||||
notes_title: Show all notes
|
notes_title: Show all notes
|
||||||
|
review_title: Make review
|
||||||
stats: Statistics
|
stats: Statistics
|
||||||
tickler_title: Tickler
|
tickler_title: Tickler
|
||||||
manage_users: Manage users
|
manage_users: Manage users
|
||||||
|
|
@ -102,6 +103,7 @@ en:
|
||||||
server_error: An error occurred on the server.
|
server_error: An error occurred on the server.
|
||||||
forum: Forum
|
forum: Forum
|
||||||
notes: Notes
|
notes: Notes
|
||||||
|
review: Review
|
||||||
last: Last
|
last: Last
|
||||||
projects: Projects
|
projects: Projects
|
||||||
action: Action
|
action: Action
|
||||||
|
|
@ -579,6 +581,12 @@ en:
|
||||||
active_plural: Active
|
active_plural: Active
|
||||||
hidden: Hidden
|
hidden: Hidden
|
||||||
active: Active
|
active: Active
|
||||||
|
review_plural: Dated
|
||||||
|
review: Dated
|
||||||
|
stalled_plural: Stalled
|
||||||
|
stalled: Stalled
|
||||||
|
blocked_plural: Blocked
|
||||||
|
blocked: Blocked
|
||||||
projects:
|
projects:
|
||||||
was_marked_hidden: has been marked as hidden
|
was_marked_hidden: has been marked as hidden
|
||||||
edit_project_title: Edit project
|
edit_project_title: Edit project
|
||||||
|
|
@ -616,6 +624,7 @@ en:
|
||||||
completed_projects: Completed projects
|
completed_projects: Completed projects
|
||||||
with_default_tags: and with '%{tags}' as the default tags
|
with_default_tags: and with '%{tags}' as the default tags
|
||||||
list_projects: TRACKS::List Projects
|
list_projects: TRACKS::List Projects
|
||||||
|
list_reviews: TRACKS::Review
|
||||||
project_saved_status: Project saved
|
project_saved_status: Project saved
|
||||||
add_project: Add Project
|
add_project: Add Project
|
||||||
add_note: Add a note
|
add_note: Add a note
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@ module NavigationHelpers
|
||||||
notes_path(options)
|
notes_path(options)
|
||||||
when /the calendar page/
|
when /the calendar page/
|
||||||
calendar_path(options)
|
calendar_path(options)
|
||||||
|
when /the review page/
|
||||||
|
@source_view = "review"
|
||||||
|
review_path(options)
|
||||||
when /the contexts page/
|
when /the contexts page/
|
||||||
@source_view = "contexts"
|
@source_view = "contexts"
|
||||||
contexts_path(options)
|
contexts_path(options)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue