mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-05 12:30:15 +01:00
migrate dependencies
without functional changes
This commit is contained in:
parent
bf5e378301
commit
a02f1d2584
14 changed files with 334 additions and 143 deletions
|
|
@ -10,16 +10,28 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
<div id="<%= dom_id(successor, 'successor_line') %>">
|
||||
<div class="description<%= staleness_class( successor ) %>" style="margin-left: 20px">
|
||||
<span class="todo.descr"><%= h sanitize(successor.description) %></span>
|
||||
|
||||
<%= link_to_remote(
|
||||
|
||||
<%= remote_delete_dependency(successor, predecessor) %>
|
||||
|
||||
<%# link_to_remote(
|
||||
image_tag("blank.png", :title => t('todos.remove_dependency'), :align => "absmiddle", :class => "delete_item"),
|
||||
{:url => {:controller => 'todos', :action => 'remove_predecessor', :id => successor.id},
|
||||
:method => 'delete',
|
||||
:with => "'#{parameters}&predecessor=#{predecessor.id}'",
|
||||
:before => successor_start_waiting_js(successor)},
|
||||
:method => 'delete',
|
||||
:with => "'#{parameters}&predecessor=#{predecessor.id}'",
|
||||
:before => successor_start_waiting_js(successor)},
|
||||
{:style => "background: transparent;"}) %>
|
||||
|
||||
<%= render(:partial => "todos/toggle_successors", :object => successor, :locals => { :suppress_button => true }) unless successor.pending_successors.empty? %>
|
||||
|
||||
<% unless successor.pending_successors.empty? %>
|
||||
<div class="todo_successors" id="<%= dom_id(successor, 'successors') %>">
|
||||
<%= render :partial => "todos/successor",
|
||||
:collection => successor.pending_successors,
|
||||
:locals => { :todo => successor,
|
||||
:parent_container_type => parent_container_type,
|
||||
:suppress_dependencies => true,
|
||||
:predecessor => successor }
|
||||
%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<%
|
||||
@todo = todo
|
||||
suppress_context ||= false
|
||||
suppress_project ||= false
|
||||
suppress_edit_button ||= todo.completed?
|
||||
|
|
@ -9,9 +8,9 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
%>
|
||||
<div id="<%= dom_id(todo) %>" class="item-container">
|
||||
<div id="<%= dom_id(todo, 'line') %>" class="item-show">
|
||||
<%= remote_star_icon %>
|
||||
<%= remote_toggle_checkbox unless source_view_is :deferred %>
|
||||
<%= remote_edit_button unless suppress_edit_button %>
|
||||
<%= remote_star_icon(todo) %>
|
||||
<%= remote_toggle_checkbox(todo) unless source_view_is :deferred %>
|
||||
<%= remote_edit_button(todo) unless suppress_edit_button %>
|
||||
<ul class="sf-menu sf-item-menu">
|
||||
<li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :alt=> "" %>
|
||||
<ul id="ul<%= dom_id(todo) %>">
|
||||
|
|
@ -25,13 +24,13 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
</li>
|
||||
</ul>
|
||||
<div class="description<%= staleness_class( todo ) %>">
|
||||
<%= grip_span %>
|
||||
<%= date_span -%>
|
||||
<%= grip_span(todo) %>
|
||||
<%= date_span(todo) -%>
|
||||
<span class="todo.descr"><%= h todo.description %></span>
|
||||
<%= image_tag_for_recurring_todo(todo) if @todo.from_recurring_todo? %>
|
||||
<%= tag_list %>
|
||||
<%= deferred_due_date %>
|
||||
<%= project_and_context_links( parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
|
||||
<%= image_tag_for_recurring_todo(todo) if todo.from_recurring_todo? %>
|
||||
<%= tag_list(todo) %>
|
||||
<%= deferred_due_date(todo) %>
|
||||
<%= project_and_context_links( todo, parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
|
||||
<%= collapsed_notes_image(todo) if todo.notes? %>
|
||||
<%= collapsed_successors_image(todo) unless todo.pending_successors.empty? %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function replace_updated_predecessor() {
|
|||
|
||||
function show_in_tickler_box() {
|
||||
$("#tickler-empty-nd").hide();
|
||||
$('#tickler').html( html_for_deferred_todos() );
|
||||
$('#tickler').append( html_for_deferred_todo() );
|
||||
}
|
||||
|
||||
function regenerate_predecessor_family() {
|
||||
|
|
@ -37,12 +37,8 @@ function html_for_predecessor() {
|
|||
return "<%= escape_javascript(render(:partial => @predecessor, :locals => { :parent_container_type => parent_container_type })) %>";
|
||||
}
|
||||
|
||||
function html_for_deferred_todos() {
|
||||
return "<%= escape_javascript(render(:partial => 'todos/deferred', :locals => { :deferred => @todo.project.deferred_todos,
|
||||
:collapsible => false,
|
||||
:append_descriptor => t('todos.append_in_this_project'),
|
||||
:parent_container_type => 'project',
|
||||
:pending => @todo.project.pending_todos })) %>";
|
||||
function html_for_deferred_todo() {
|
||||
return "<%= escape_javascript(render(:partial => @todo, :locals => { :parent_container_type => parent_container_type })) %>";
|
||||
}
|
||||
|
||||
<% end # if !@saved
|
||||
|
|
|
|||
|
|
@ -1,35 +1,63 @@
|
|||
if @removed
|
||||
status_message = t('todos.removed_predecessor', :successor => @successor.description, :predecessor => @predecessor.description)
|
||||
page.notify :notice, status_message, 5.0
|
||||
<% # TODO: lots of overlap with add_predecessor --> helpers?
|
||||
if @removed -%>
|
||||
TracksPages.page_notify('notice', "<%= t('todos.removed_predecessor', :successor => @successor.description, :predecessor => @predecessor.description) %>", 8);
|
||||
|
||||
# replace old predecessor with one without the successor
|
||||
page.replace dom_id(@predecessor), :partial => 'todos/todo', :locals => {
|
||||
:todo => @predecessor, :parent_container_type => parent_container_type }
|
||||
replace_updated_predecessor();
|
||||
regenerate_predecessor_family();
|
||||
update_successor();
|
||||
<% else -%>
|
||||
TracksPages.page_notify('error', "<%=t('todos.error_removing_dependency')%>", 8);
|
||||
<% end -%>
|
||||
|
||||
# regenerate predecessor family
|
||||
function replace_updated_predecessor() {
|
||||
$('#<%= dom_id(@predecessor) %>').html( html_for_predecessor() );
|
||||
}
|
||||
|
||||
function regenerate_predecessor_family() {
|
||||
<%
|
||||
parents = @predecessor.predecessors
|
||||
until parents.empty?
|
||||
parent = parents.pop
|
||||
parents += parent.predecessors
|
||||
page[parent].replace_html :partial => 'todos/todo', :locals => { :todo => parent, :parent_container_type => parent_container_type }
|
||||
parents += parent.predecessors -%>
|
||||
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :parent_container_type => parent_container_type })) %>");
|
||||
<%end -%>
|
||||
}
|
||||
|
||||
function update_successor() {
|
||||
<%
|
||||
if @successor.active? -%>
|
||||
<%= "remove_successor();" unless source_view_is_one_of(:todo, :context) %>
|
||||
<%= "hide_empty_message();" unless empty_container_msg_div_id.nil? %>
|
||||
<%= "show_empty_deferred_message(); " if @remaining_deferred_or_pending_count == 0 %>
|
||||
<% if source_view_is_one_of(:todo, :deferred, :tag) -%>
|
||||
$('#c<%= @successor.context_id %>').fadeIn(500, function() {});
|
||||
$('#no_todos_in_tag_view').slideUp(100);
|
||||
<% end -%>
|
||||
$('#<%=item_container_id(@successor)%>').append(html_for_new_successor());
|
||||
$('#<%= dom_id(@successor, 'line')%>').effect('highlight', {}, 2000 ); <%
|
||||
elsif @successor.deferred? -%>
|
||||
$('#<%= dom_id(@successor)%>').html(html_for_new_successor()); <%
|
||||
end
|
||||
|
||||
# update display if pending->active
|
||||
if @successor.active?
|
||||
page[@successor].remove unless source_view_is_one_of(:todo, :context)
|
||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@successor.context_id}"
|
||||
page.insert_html :bottom, item_container_id(@successor), :partial => 'todos/todo', :locals => {
|
||||
:todo => @successor, :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, dom_id(@successor, 'line'), {'startcolor' => "'#99ff99'"}
|
||||
end
|
||||
|
||||
# update display if pending->deferred
|
||||
if @successor.deferred?
|
||||
page.replace dom_id(@successor), :partial => 'todos/todo', :locals => {
|
||||
:todo => @successor, :parent_container_type => parent_container_type }
|
||||
end
|
||||
page << "enable_rich_interaction();"
|
||||
else
|
||||
page.notify :error, t('todos.error_removing_dependency'), 8.0
|
||||
end
|
||||
%>
|
||||
}
|
||||
|
||||
function hide_empty_message() {
|
||||
$('#<%=empty_container_msg_div_id%>').hide();
|
||||
}
|
||||
|
||||
function show_empty_deferred_message() {
|
||||
$('#tickler-empty-nd').slideDown(100);
|
||||
}
|
||||
function remove_successor() {
|
||||
<% # TODO: last todo in context --> remove context??
|
||||
-%>
|
||||
$('#<%=dom_id(@successor)%>').remove();
|
||||
}
|
||||
|
||||
function html_for_predecessor() {
|
||||
return "<%= @removed ? escape_javascript(render(:partial => @predecessor, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
}
|
||||
|
||||
function html_for_new_successor() {
|
||||
return "<%= @removed ? escape_javascript(render(:partial => @successor, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
animation << "hide_context" if update_needs_to_hide_context
|
||||
animation << "highlight_updated_todo"
|
||||
animation << "update_empty_tag_container" if source_view_is(:tag)
|
||||
animation << "update_predecessors"
|
||||
%>
|
||||
|
||||
<%= render_animation(animation) %>
|
||||
|
|
@ -35,7 +36,7 @@ function add_to_existing_container(next_steps) {
|
|||
$('#<%= item_container_id(@todo) %>').append(html_for_todo());
|
||||
<% if source_view_is_one_of(:project,:calendar) -%>
|
||||
next_steps.go();
|
||||
<% if (@target_context_count==1) || (@todo.deferred? && @remaining_deferred_or_pending_count == 1) -%>
|
||||
<% if (@target_context_count==1) || ( (@todo.deferred? || @todo.pending?) && @remaining_deferred_or_pending_count == 1) -%>
|
||||
$("#<%= empty_container_msg_div_id %>").slideUp(100);
|
||||
<% end -%>
|
||||
<% else -%>
|
||||
|
|
@ -109,4 +110,9 @@ function update_predecessors() {
|
|||
$('#<%=dom_id(p)%>').html('<%=escape_javascript(render(:partial => p, :locals => { :parent_container_type => parent_container_type }))%>');
|
||||
}
|
||||
<% end -%>
|
||||
<% @removed_predecessors.each do |p| -%>
|
||||
if ($('#<%=item_container_id(p)%>')) {
|
||||
$('#<%=dom_id(p)%>').html('<%=escape_javascript(render(:partial => p, :locals => { :parent_container_type => parent_container_type }))%>');
|
||||
}
|
||||
<% end -%>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue