mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-03 11:30:15 +01:00
add done views to projects and recurring todos
This commit is contained in:
parent
5496b84642
commit
35f947ec57
13 changed files with 166 additions and 20 deletions
|
|
@ -32,6 +32,24 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def done
|
||||
@source_view = params['_source_view'] || 'project_list'
|
||||
@page_title = t('projects.list_completed_projects')
|
||||
|
||||
page = params[:page] || 1
|
||||
projects_per_page = 20
|
||||
@projects = current_user.projects.completed.paginate :page => page, :per_page => projects_per_page
|
||||
@count = @projects.count
|
||||
@total = current_user.projects.completed.count
|
||||
@no_projects = @projects.empty?
|
||||
|
||||
@range_low = (page.to_i-1) * projects_per_page + 1
|
||||
@range_high = @range_low + @projects.size - 1
|
||||
|
||||
init_not_done_counts(['project'])
|
||||
render
|
||||
end
|
||||
|
||||
def projects_and_actions
|
||||
@projects = current_user.projects.active
|
||||
|
|
@ -259,7 +277,8 @@ class ProjectsController < ApplicationController
|
|||
@count = current_user.projects.count
|
||||
@active_projects = current_user.projects.active
|
||||
@hidden_projects = current_user.projects.hidden
|
||||
@completed_projects = current_user.projects.completed
|
||||
@completed_projects = current_user.projects.completed.find(:all, :limit => 10)
|
||||
@completed_count = current_user.projects.completed.count
|
||||
@no_projects = current_user.projects.empty?
|
||||
current_user.projects.cache_note_counts
|
||||
@new_project = current_user.projects.build
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class RecurringTodosController < ApplicationController
|
|||
|
||||
find_and_inactivate
|
||||
@recurring_todos = current_user.recurring_todos.active
|
||||
@completed_recurring_todos = current_user.recurring_todos.completed
|
||||
@completed_recurring_todos = current_user.recurring_todos.completed.find(:all, :limit => 10)
|
||||
|
||||
@no_recurring_todos = @recurring_todos.size == 0
|
||||
@no_completed_recurring_todos = @completed_recurring_todos.size == 0
|
||||
|
|
@ -24,6 +24,16 @@ class RecurringTodosController < ApplicationController
|
|||
|
||||
def show
|
||||
end
|
||||
|
||||
def done
|
||||
@page_title = t('todos.completed_recurring_actions_title')
|
||||
items_per_page = 20
|
||||
page = params[:page] || 1
|
||||
@completed_recurring_todos = current_user.recurring_todos.completed.paginate :page => params[:page], :per_page => items_per_page
|
||||
@total = @count = current_user.recurring_todos.completed.count
|
||||
@range_low = (page.to_i-1) * items_per_page + 1
|
||||
@range_high = @range_low + @completed_recurring_todos.size - 1
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
<%-
|
||||
total_count ||= -1
|
||||
total_count_string = total_count!=-1 ? " / #{total_count}" : ""
|
||||
-%>
|
||||
<div class="project-state-group" id="list-<%= state %>-projects-container" <%= " style=\"display:none\"" if project_state_group.empty? %>>
|
||||
<h2><span id="<%= state %>-projects-count" class="badge"><%= project_state_group.length %></span><%= t('states.'+state+'_plural' )%> <%= t('common.projects') %></h2>
|
||||
<h2>
|
||||
<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)+")"%>
|
||||
</h2>
|
||||
<div class="menu_sort"><span class="sort_separator"><%= t('common.sort.sort') %> </span>
|
||||
<div class="alpha_sort">
|
||||
<%= link_to(t("common.sort.alphabetically"), alphabetize_projects_path(:state => state),
|
||||
|
|
|
|||
37
app/views/projects/done.html.erb
Normal file
37
app/views/projects/done.html.erb
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<%
|
||||
paginate_options = {
|
||||
:class => :add_note_link,
|
||||
:previous_label => '« '+ t('common.previous'),
|
||||
:next_label => t('common.next')+' »',
|
||||
:inner_window => 2
|
||||
}
|
||||
%>
|
||||
<div id="display_box">
|
||||
<div id="projects-empty-nd" style="<%= @no_projects ? 'display:block' : 'display:none'%>">
|
||||
<div class="message"><p><%= t('projects.no_projects') %></p></div>
|
||||
</div>
|
||||
|
||||
<div class="project-state-group" id="list-completed-projects-container" <%= " style=\"display:none\"" if @no_projects %>>
|
||||
<%= will_paginate @projects, paginate_options %>
|
||||
<h2>
|
||||
<span id="completed-projects-count" class="badge"><%= "#{@total} (#{@range_low}-#{@range_high})" %></span>
|
||||
<%= t('states.completed_plural' )%> <%= t('common.projects') %>
|
||||
</h2>
|
||||
<div id="list-completed-projects" class="project-list">
|
||||
<%= render :partial => 'project_listing', :collection => @projects %>
|
||||
</div>
|
||||
</div>
|
||||
<%= will_paginate @projects, paginate_options %>
|
||||
</div>
|
||||
|
||||
<div id="input_box">
|
||||
<div class="menu_sort"><h2><br/><%= t('common.sort.sort') %> <%= t('states.completed_plural' )%> <%= t('common.projects') %></h2>
|
||||
<div class="alpha_sort">
|
||||
<%= link_to(t("common.sort.alphabetically"), alphabetize_projects_path(:state => :completed),
|
||||
:id => "completed_alphabetize_link", :class => "alphabetize_link", :title => t('common.sort.alphabetically_title'), :x_confirm_message => t('common.sort.alphabetically_confirm')) %>
|
||||
</div><span class="sort_separator"> | </span><div class="tasks_sort">
|
||||
<%= link_to(t("common.sort.by_task_count"), actionize_projects_path(:state => :completed),
|
||||
:id => "completed_actionize_link", :class => "actionize_link", :title => t('common.sort.by_task_count_title'), :x_confirm_message => t('common.sort.by_task_count_title_confirm')) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
<%= render :partial => 'project_state_group', :object => @active_projects, :locals => { :state => 'active'} %>
|
||||
<%= render :partial => 'project_state_group', :object => @hidden_projects, :locals => { :state => 'hidden'} %>
|
||||
<%= render :partial => 'project_state_group', :object => @completed_projects, :locals => { :state => 'completed'} %>
|
||||
<%= render :partial => 'project_state_group', :object => @completed_projects, :locals => { :state => 'completed', :total_count => @completed_count} %>
|
||||
</div>
|
||||
|
||||
<div id="input_box">
|
||||
|
|
|
|||
24
app/views/recurring_todos/done.html.erb
Normal file
24
app/views/recurring_todos/done.html.erb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<%
|
||||
paginate_options = {
|
||||
:class => :add_note_link,
|
||||
:previous_label => '« '+ t('common.previous'),
|
||||
:next_label => t('common.next')+' »',
|
||||
:inner_window => 2
|
||||
}
|
||||
%>
|
||||
<div id="display_box">
|
||||
<div class="container" id="completed_recurring_todos_container">
|
||||
<%= will_paginate @completed_recurring_todos, paginate_options %>
|
||||
<h2>
|
||||
<span id="completed-projects-count" class="badge"><%= "#{@total} (#{@range_low}-#{@range_high})" %></span>
|
||||
<%= t('todos.completed_recurring') %>
|
||||
</h2>
|
||||
<div id="completed_recurring_todos_container">
|
||||
<div id="completed-empty-nd" style="<%= @no_completed_recurring_todos ? 'display:block' : 'display:none'%>">
|
||||
<div class="message"><p><%= t('todos.no_completed_recurring') %></p></div>
|
||||
</div>
|
||||
<%= render :partial => @completed_recurring_todos %>
|
||||
</div>
|
||||
<%= will_paginate @completed_recurring_todos, paginate_options %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -10,7 +10,8 @@
|
|||
</div>
|
||||
|
||||
<div class="container" id="completed_recurring_todos_container">
|
||||
<h2><%= t('todos.completed_recurring') %></h2>
|
||||
<div class=add_note_link><%= link_to "Show all", done_recurring_todos_path%></div>
|
||||
<h2><%= t('common.last') %> <%= t('todos.completed_recurring') %></h2>
|
||||
<div id="completed_recurring_todos_container">
|
||||
<div id="completed-empty-nd" style="<%= @no_completed_recurring_todos ? 'display:block' : 'display:none'%>">
|
||||
<div class="message"><p><%= t('todos.no_completed_recurring') %></p></div>
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
<h1>RecurringTodo#show</h1>
|
||||
<p>Find me in app/views/recurring_todo/show.html.erb</p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue