do a big refactor of rendering collections of todos for home page, tag page, project page, context page

This commit is contained in:
Reinier Balt 2013-03-10 20:38:10 +01:00
parent f22dfc1f9b
commit 22b371ef8c
20 changed files with 910 additions and 816 deletions

View file

@ -4,17 +4,17 @@
# rendering of "due in x days" that change without touching updated at of the todo
cache [context, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] do
%>
<div id="c<%= context.id %>" class="container context" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
<h2>
<%= container_toggle("toggle_c#{context.id}") %>
<%= show_context_name(context) %>
</h2>
<div id="c_<%=context.id%>_target" class="context_target drop_target"></div>
<div id="c<%= context.id %>items" class="items toggle_target">
<div id="c<%= context.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
<div class="message"><p><%= t 'contexts.no_actions' %></p></div>
</div>
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
</div>
</div>
<%=
render :partial => 'todos/collection',
:object => @not_done,
:locals => { :settings => {
:id => "c#{context.id}",
:collapsible => settings[:collapsible],
:container_name => 'context',
:title => show_context_name(context),
:show_empty_containers => @show_empty_containers
}}
%>
<% end %>

View file

@ -1,9 +1,14 @@
<%
suffix_completed = t('contexts.last_completed_in_context', :number=>prefs.show_number_completed)
deferred_pending_options = {:append_descriptor => nil, :parent_container_type => 'context'}
done_todo_options = {:append_descriptor => suffix_completed, :suppress_context => true, :parent_container_type => 'context'}
-%>
<div id="display_box">
<%= render :partial => @context, :locals => { :collapsible => false } %>
<%= render :partial => "todos/deferred", :object => @deferred, :locals => { :collapsible => false, :append_descriptor => t('contexts.todos_append'), :parent_container_type => 'context', :pending => @pending } %>
<% unless @max_completed==0 -%>
<%= render :partial => "todos/completed", :object => @done, :locals => { :suppress_context => true, :collapsible => false, :append_descriptor => t('contexts.last_completed_in_context', :number=>prefs.show_number_completed) } %>
<% end -%>
<%= render :partial => @context, :locals => { :settings => {:collapsible => false }} %>
<%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %>
<%= show_done_todos(@done, done_todo_options) unless @done.nil? %>
</div>
<div id="input_box">