get all scenario's running again, first pass.

This commit is contained in:
Reinier Balt 2013-03-17 15:41:36 +01:00
parent ede898120c
commit 0a9755c8a3
27 changed files with 90 additions and 90 deletions

View file

@ -73,10 +73,9 @@ module TodosHelper
end
def todos_container(settings={})
container_name = settings[:container_name]
settings.reverse_merge!({
:id => "#{container_name}_container",
:class => "container #{container_name}",
:id => "#{settings[:container_name]}_container",
:class => "container #{settings[:container_name]}",
})
content_tag(:div,
@ -93,7 +92,7 @@ module TodosHelper
})
header = settings[:link_in_header].nil? ? "" : content_tag(:div, :class=>"add_note_link"){settings[:link_in_header]}
header += content_tag(:h2) do
toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:container_name]}") : ""
toggle = settings[:collapsible] ? container_toggle("toggle_#{settings[:id]}") : ""
"#{toggle} #{settings[:title]} #{settings[:append_descriptor]}".html_safe
end
header.html_safe
@ -458,12 +457,12 @@ module TodosHelper
end
def item_container_id (todo)
return "hidden_items" if source_view_is(:tag) && todo.hidden?
return "c#{todo.context_id}_items" if source_view_is :deferred
return @new_due_id if source_view_is :calendar
return "tickler_items" if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
return "completed_container_items" if todo.completed?
return "p#{todo.project_id}_items" if source_view_is :project
return "hidden_container_items" if source_view_is(:tag) && todo.hidden?
return "c#{todo.context_id}_items" if source_view_is :deferred
return @new_due_id if source_view_is :calendar
return "deferred_pending_container_items" if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
return "completed_container_items" if todo.completed?
return "p#{todo.project_id}_items" if source_view_is :project
return "c#{todo.context_id}_items"
end
@ -472,20 +471,20 @@ module TodosHelper
source_view do |page|
page.project {
return "tickler-empty-nd" if empty_criteria_met
return "deferred_pending_container-empty-d" if empty_criteria_met
return "p#{todo.project_id}-empty-d"
}
page.tag {
return "tickler-empty-nd" if empty_criteria_met
return "hidden-empty-nd" if @todo.hidden?
return "deferred_pending_container-empty-d" if empty_criteria_met
return "hidden_container-empty-d" if @todo.hidden?
return "c#{todo.context_id}-empty-d"
}
page.calendar {
return "tickler-empty-nd" if empty_criteria_met
return "deferred_pending_container-empty-d" if empty_criteria_met
return "empty_#{@new_due_id}"
}
page.context {
return "tickler-empty-nd" if empty_criteria_met
return "deferred_pending_container-empty-d" if empty_criteria_met
return "c#{todo.context_id}-empty-d"
}
end
@ -513,25 +512,25 @@ module TodosHelper
container_id = ""
source_view do |page|
page.project {
container_id = "p#{@original_item_project_id}empty-nd" if @remaining_in_context == 0
container_id = "tickler-empty-nd" if todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0
container_id = "empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
container_id = "p#{@original_item_project_id}-empty-d" if @remaining_in_context == 0
container_id = "deferred_pending_container-empty-d" if todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0
container_id = "completed_container-empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
}
page.deferred { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
page.deferred { container_id = "c#{@original_item_context_id}empty-d" if @remaining_in_context == 0 }
page.calendar { container_id = "empty_#{@original_item_due_id}" if @old_due_empty }
page.tag {
container_id = "hidden-empty-nd" if (@remaining_hidden_count == 0 && !@todo.hidden? && @todo_hidden_state_changed) ||
container_id = "hidden_container-empty-d" if (@remaining_hidden_count == 0 && !@todo.hidden? && @todo_hidden_state_changed) ||
(@remaining_hidden_count == 0 && @todo.completed? && @original_item_was_hidden)
container_id = "tickler-empty-nd" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
container_id = "deferred_pending_container-empty-d" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
(@original_item_was_deferred && @remaining_deferred_or_pending_count == 0 && (@todo.completed? || @tag_was_removed))
container_id = "empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
container_id = "completed_container-empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
}
page.context {
container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0
container_id = "tickler-empty-nd" if todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0
container_id = "empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
container_id = "c#{@original_item_context_id}-empty-d" if @remaining_in_context == 0
container_id = "deferred_pending_container-empty-d" if todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0
container_id = "completed_container-empty-d" if @completed_count && @completed_count == 0 && !@todo.completed?
}
page.todo { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
page.todo { container_id = "c#{@original_item_context_id}-empty-d" if @remaining_in_context == 0 }
end
return container_id.blank? ? "" : "$(\"##{container_id}\").slideDown(100);".html_safe
end

View file

@ -16,7 +16,7 @@ cache [project, @source_view, current_user.date.strftime("%Y%m%d")] do
:collapsible => settings[:collapsible],
:title => title,
:container_name => 'project',
:show_empty_containers => @show_empty_containers
:show_empty_containers => settings[:show_empty_containers]
}}
%>

View file

@ -12,7 +12,7 @@ function html_for_edit_form() {
function show_edit_form() {
$('<%= selector_edit %>').html(html_for_edit_form());
$('<%= selector_edit %>').fadeIn(500);
$('div#project_name').editable('disable');
$('span#project_name').editable('disable');
}
function set_focus() {

View file

@ -9,7 +9,7 @@
<div id="display_box">
<%= project_next_prev %>
<%= render :partial => @project, :locals => {:settings => {:collapsible => false }} %>
<%= render :partial => @project, :locals => {:settings => {:collapsible => false, :show_empty_containers => true }} %>
<%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %>

View file

@ -5,14 +5,14 @@
<div class="project_description"><%= sanitize(@project.description) %></div>
<% end -%>
<ul class="c">
<%= render :partial => @not_done, :locals => { :parent_container_type => "project" }%>
<%= render :partial => @not_done_todos, :locals => { :parent_container_type => "project" }%>
</ul>
<h2><%= t('projects.deferred_actions')%></h2>
<% if @deferred.empty? -%>
<% if @deferred_todos.empty? -%>
<%= t('projects.deferred_actions_empty') %>
<% else -%>
<ul class="c">
<%= render :partial => @deferred, :locals => { :parent_container_type => "project" }%>
<%= render :partial => @deferred_todos, :locals => { :parent_container_type => "project" }%>
</ul><% end
-%>
<h2><%= t('projects.completed_actions')%></h2>

View file

@ -31,7 +31,7 @@ function update_project_page() {
remove_project_edit_form();
update_and_show_project_settings();
TracksForm.set_project_name("<%= escape_javascript(@project.name)%>");
$("h2 div#project_name").html("<%= escape_javascript(@project.name)%>");
$("h2 span#project_name").html("<%= escape_javascript(@project.name)%>");
<% if @project.default_context %>
TracksForm.set_context_name_and_default_context_name("<%= escape_javascript(@project.default_context.name)%>");
<% end %>

View file

@ -1,5 +1,5 @@
<% if @not_done_todos.empty? -%>
<p><%= t('todos.no_incomplete_actions') %></p>
<p><%= t('todos.no_actions.not_done') %></p>
<% else -%>
<%= render :partial => @contexts_to_show -%>
<% end -%>

View file

@ -23,8 +23,8 @@ function replace_updated_predecessor() {
}
function show_in_tickler_box() {
$("#tickler-empty-nd").hide();
$('#tickler').append( html_for_todo() );
$("#deferred_pending_container-empty-d").hide();
$('#deferred_pending_container').append( html_for_todo() );
}
function regenerate_predecessor_family() {

View file

@ -32,7 +32,7 @@
function insert_new_context_with_new_todo() {
<%-
empty_id = '#no_todos_in_view'
empty_id = '#tickler-empty-nd' if source_view_is :tickler
empty_id = '#deferred_pending_container-empty-d' if source_view_is :tickler
-%>
$('<%=empty_id%>').slideUp(100);
$('#display_box').prepend(html_for_new_context());
@ -43,7 +43,7 @@
<% unless source_view_is_one_of(:todo, :tag) && (@todo.deferred?||@todo.hidden?) -%>
$('#c<%= @todo.context_id %>').fadeIn(500, function() {});
$('#no_todos_in_view').slideUp(100);
<%= "$('#tickler-empty-nd').slideUp(100);".html_safe if source_view_is(:deferred) && @todo.deferred? %>
<%= "$('#deferred_pending_container-empty-nd').slideUp(100);".html_safe if source_view_is(:deferred) && @todo.deferred? %>
<% end -%>
<% end -%>
$('#<%=empty_container_msg_div_id%>').hide();
@ -60,7 +60,7 @@
}
function html_for_new_context() {
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @todo.context, :locals => { :collapsible => true })) : "" %>";
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @todo.context, :locals => { :settings => {:collapsible => true} })) : "" %>";
}
function html_for_new_todo() {

View file

@ -39,7 +39,7 @@ function insert_new_context_with_new_todo() {
function hide_empty_message() {
$('#<%=empty_container_msg_div_id%>').hide();
<% if (source_view_is :project and @todo.pending?) or (source_view_is :deferred) -%>
$('#tickler-empty-nd').hide();
$('#deferred_pending_container-empty-d').hide();
<% end -%>
}
@ -56,7 +56,7 @@ function add_todo_to_existing_context() {
}
function html_for_new_context() {
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @todo.context, :locals => { :collapsible => true })) : "" %>";
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @todo.context, :locals => { :settings => {:collapsible => true} })) : "" %>";
}
<% else # if @saved -%>

View file

@ -27,7 +27,7 @@ function show_empty_messages() {
<% end -%>
<% if source_view_is(:deferred) && @down_count==0 -%>
$('#tickler-empty-nd').slideDown(100);
$('#deferred_pending_container-empty-d').slideDown(100);
<% end -%>
}
@ -80,7 +80,7 @@ function activate_pending_todos() {
$('#<%= dom_id(t) %>').fadeOut(400, function() {
$('#<%= dom_id(t) %>').remove();
$('#<%= item_container_id(t) %>').append("<%= html %>");
<%= "$('#tickler-empty-nd').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
<%= "$('#deferred_pending_container-empty-d').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
});
<% else -%>
$('#<%= item_container_id(t) %>').append("<%= html%>");

View file

@ -7,7 +7,7 @@
<%= show_todos_without_project(@todos_without_project) unless @todos_without_project.nil? -%>
<% end -%>
<%= show_done_todos(@done, {:collapsible => true}) unless @done.nil? %>
<%= show_done_todos(@done, {:parent_container_type => 'home', :collapsible => true}) unless @done.nil? %>
</div>
<div id="input_box">

View file

@ -1,10 +1,8 @@
<div id="display_box">
<div id="tickler-empty-nd" style="display:<%= (@count == 0) ? 'block' : 'none'%>;">
<div class="message"><p><%= t('todos.no_deferred_actions') %></p></div>
</div>
<%= empty_message_holder("deferred_pending", @not_done_todos.empty?) %>
<%= render :partial => @contexts, :locals => { :collapsible => true } %>
<%= render :partial => @contexts, :locals => { :settings => {:collapsible => true} } %>
</div>
<div id="input_box">

View file

@ -46,7 +46,7 @@ function hide_empty_message() {
}
function show_empty_deferred_message() {
$('#tickler-empty-nd').slideDown(100);
$('#deferred_pending_container-empty-d').slideDown(100);
}
function remove_successor() {
<% # TODO: last todo in context --> remove context??

View file

@ -54,7 +54,7 @@ function remove_todo(next_steps) {
function add_to_completed_container(next_steps) {
<% unless current_user.prefs.hide_completed_actions? -%>
$('#<%= item_container_id(@todo) %>').prepend(html_for_todo());
$("#empty-d").slideUp(100);
$("#completed_container-empty-d").slideUp(100);
highlight_updated_todo(next_steps);
<% end -%>
}
@ -76,7 +76,7 @@ function add_todo_to_context(next_steps) {
highlight_updated_todo(next_steps);
<% end -%>
<% if @completed_count == 0 -%>
$("#empty-d").slideDown(100);
$("#completed_container-empty-d").slideDown(100);
<% end -%>
}
@ -130,7 +130,7 @@ function activate_pending_todos(next_steps) {
$('#<%= dom_id(t) %>').fadeOut(400, function() {
$('#<%= dom_id(t) %>').remove();
$('#<%= item_container_id(t) %>').append("<%= html %>");
<%= "$('#tickler-empty-nd').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
<%= "$('#deferred_pending_container-empty-d').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
});
<% else -%>
$('#<%= item_container_id(t) %>').append("<%= html%>");

View file

@ -15,7 +15,7 @@
end
animation << "hide_context" if update_needs_to_hide_context
animation << "highlight_updated_todo"
animation << "update_empty_container" if source_view_is_one_of(:tag, :todo)
animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred)
animation << "update_predecessors"
%>
@ -72,7 +72,7 @@ function replace_todo(next_steps) {
function hide_context(next_steps) {
<% context_id = @context_changed ? @original_item_context_id : @todo.context_id -%>
$('#c<%= context_id %>').fadeOut(400, function(){ next_steps.go(); });
<%= "$('#tickler-empty-nd').slideDown(400);".html_safe if source_view_is(:deferred) && @down_count == 0 %>
<%= "$('#deferred_pending_container_empty-nd').slideDown(400);".html_safe if source_view_is(:deferred) && @down_count == 0 %>
}
function highlight_updated_todo(next_steps) {
@ -82,9 +82,9 @@ function highlight_updated_todo(next_steps) {
function update_empty_container(next_steps) {
<% if @down_count==0 -%>
$('#no_todos_in_view').slideDown(400, function(){ next_steps.go(); });
$('div#no_todos_in_view').slideDown(400, function(){ next_steps.go(); });
<% else -%>
$('#no_todos_in_view').fadeOut(100, function(){ next_steps.go(); });
$('div#no_todos_in_view').fadeOut(100, function(){ next_steps.go(); });
<% end -%>
}
@ -130,8 +130,10 @@ function regenerate_predecessor_family() {
parents = @todo.predecessors
until parents.empty?
parent = parents.pop
parents += parent.predecessors -%>
parents += parent.predecessors
-%>
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :settings => {:parent_container_type => parent_container_type }})) %>");
<%end
<%
end
-%>
}