mirror of
https://github.com/TracksApp/tracks.git
synced 2026-04-18 10:09:02 +02:00
add some project grouping scenarios to edit_a_todo and fix failures
also refactor step definitions
This commit is contained in:
parent
5f8f2eefa9
commit
8641ecfc4e
16 changed files with 487 additions and 422 deletions
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
function add_todo_to_existing_container(next_steps) {
|
||||
$('#<%= empty_container_msg_div_id %>').hide();
|
||||
$('#<%= item_container_id(@todo) %>').append(html_for_new_todo());
|
||||
$('#<%= item_container_id(@todo) %>_items').append(html_for_new_todo());
|
||||
$('#<%= item_container_id(@todo) %>').slideDown(500, function() {
|
||||
$('#<%= dom_id(@todo) %>').effect('highlight', {}, 2000 );
|
||||
next_steps.go();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ function show_new_todo_if_todo_was_recurring() {
|
|||
<% if @todo.from_recurring_todo? -%>
|
||||
<% unless @new_recurring_todo.nil? || @new_recurring_todo.deferred? -%>
|
||||
TodoItemsContainer.ensureVisibleWithEffectAppear("<%=item_container_id(@new_recurring_todo)%>");
|
||||
$('#<%=item_container_id(@new_recurring_todo)%>').append(html_for_new_recurring_todo());
|
||||
$('#<%=item_container_id(@new_recurring_todo)%>_items').append(html_for_new_recurring_todo());
|
||||
$('#<%= dom_id(@new_recurring_todo, 'line')%>').effect('highlight', {}, 2000 );
|
||||
TracksPages.page_notify('notice', "<%=t('todos.recurring_action_deleted')%>", 5);
|
||||
<% else -%>
|
||||
|
|
@ -75,11 +75,11 @@ function activate_pending_todos() {
|
|||
if source_view_is_one_of(:project,:tag) -%>
|
||||
$('#<%= dom_id(t) %>').fadeOut(400, function() {
|
||||
$('#<%= dom_id(t) %>').remove();
|
||||
$('#<%= item_container_id(t) %>').append("<%= html %>");
|
||||
$('#<%= item_container_id(t) %>_items').append("<%= html %>");
|
||||
<%= "$('#deferred_pending_container-empty-d').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
|
||||
});
|
||||
<% else -%>
|
||||
$('#<%= item_container_id(t) %>').append("<%= html%>");
|
||||
$('#<%= item_container_id(t) %>_items').append("<%= html%>");
|
||||
<% end -%>
|
||||
TodoItems.highlight_todo('#<%= dom_id(t, 'line')%>');
|
||||
<% end -%>
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@
|
|||
animation << "add_to_completed_container" unless source_view_is_one_of(:calendar, :deferred)
|
||||
animation << "add_new_recurring_todo"
|
||||
animation << "activate_pending_todos"
|
||||
animation << "remove_source_container"
|
||||
else
|
||||
animation << "add_todo_to_context" unless source_view_is(:done)
|
||||
animation << "add_todo_to_container" unless source_view_is(:done)
|
||||
animation << "block_predecessors"
|
||||
end
|
||||
animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred)
|
||||
|
|
@ -34,7 +33,7 @@ function remove_todo(next_steps) {
|
|||
<% if (@remaining_in_context == 0) && update_needs_to_hide_container
|
||||
# remove context with deleted todo
|
||||
-%>
|
||||
$('#c<%=@todo.context_id%>').fadeOut(400, function() {
|
||||
$('#<%= item_container_id(@original_item)%>').slideUp(400, function() {
|
||||
$('#<%=dom_id(@todo)%>').remove();
|
||||
next_steps.go();
|
||||
});
|
||||
|
|
@ -52,7 +51,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());
|
||||
$('#<%= item_container_id(@todo) %>_items').prepend(html_for_todo());
|
||||
$("#completed_container-empty-d").slideUp(100);
|
||||
highlight_updated_todo(next_steps);
|
||||
<% end -%>
|
||||
|
|
@ -63,10 +62,11 @@ function replace_todo(next_steps) {
|
|||
next_steps.go();
|
||||
}
|
||||
|
||||
function add_todo_to_context(next_steps) {
|
||||
$('#<%= item_container_id(@todo) %>').append(html_for_todo());
|
||||
function add_todo_to_container(next_steps) {
|
||||
// <%= @group_view_by %>
|
||||
$('#<%= item_container_id(@todo) %>_items').append(html_for_todo());
|
||||
<% if should_make_context_visible -%>
|
||||
$('#c<%= @todo.context_id %>').fadeIn(500, function() {
|
||||
$('#<%= item_container_id(@todo) %>').slideDown(500, function() {
|
||||
$("#<%= empty_container_msg_div_id %>").slideUp(100);
|
||||
highlight_updated_todo(next_steps);
|
||||
});
|
||||
|
|
@ -83,8 +83,8 @@ function add_new_recurring_todo(next_steps) {
|
|||
<% # show new todo if the completed todo was recurring
|
||||
if @todo.from_recurring_todo?
|
||||
unless @new_recurring_todo.nil? || (@new_recurring_todo.deferred? && !source_view_is(:deferred)) -%>
|
||||
$('#<%= item_container_id(@new_recurring_todo) %>').append(html_for_recurring_todo());
|
||||
$('#c<%= @new_recurring_todo.context_id %>').fadeIn(500, function() {
|
||||
$('#<%= item_container_id(@new_recurring_todo) %>_items').append(html_for_recurring_todo());
|
||||
$('#c<%= @new_recurring_todo.context_id %>').slideDown(500, function() {
|
||||
highlight_updated_recurring_todo(next_steps);
|
||||
});
|
||||
<% else
|
||||
|
|
@ -102,7 +102,7 @@ function update_empty_container(next_steps) {
|
|||
<% if @down_count==0 -%>
|
||||
$('#no_todos_in_view').slideDown(400, function(){ next_steps.go(); });
|
||||
<% else -%>
|
||||
$('#no_todos_in_view').fadeOut(100, function(){ next_steps.go(); });
|
||||
$('#no_todos_in_view').slideUp(400, function(){ next_steps.go(); });
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
|
|
@ -126,13 +126,13 @@ function activate_pending_todos(next_steps) {
|
|||
html = escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))
|
||||
# only project and tag view have a deferred/blocked container
|
||||
if source_view_is_one_of(:project,:tag) -%>
|
||||
$('#<%= dom_id(t) %>').fadeOut(400, function() {
|
||||
$('#<%= dom_id(t) %>').slideUp(400, function() {
|
||||
$('#<%= dom_id(t) %>').remove();
|
||||
$('#<%= item_container_id(t) %>').append("<%= html %>");
|
||||
$('#<%= item_container_id(t) %>_items').append("<%= html %>");
|
||||
<%= "$('#deferred_pending_container-empty-d').show();".html_safe if @remaining_deferred_or_pending_count==0 -%>
|
||||
});
|
||||
<% else -%>
|
||||
$('#<%= item_container_id(t) %>').append("<%= html%>");
|
||||
$('#<%= item_container_id(t) %>_items').append("<%= html%>");
|
||||
<% end -%>
|
||||
TodoItems.highlight_todo('#<%= dom_id(t)%>');
|
||||
<% end -%>
|
||||
|
|
@ -145,10 +145,10 @@ function block_predecessors(next_steps) {
|
|||
if @saved && @active_to_block
|
||||
# do not render the js in case of an error or if no todos to block
|
||||
@active_to_block.each do |t| %>
|
||||
$('#<%= dom_id(t) %>').fadeOut(400, function() {
|
||||
$('#<%= dom_id(t) %>').slideUp(400, function() {
|
||||
$('#<%= dom_id(t) %>').remove();
|
||||
<% if source_view_is(:project) or source_view_is(:tag) # Insert it in deferred/pending block if existing -%>
|
||||
$('#<%= item_container_id(t) %>').append("<%= escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))%>");
|
||||
$('#<%= item_container_id(t) %>_items').append("<%= escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))%>");
|
||||
TodoItems.highlight_todo('#<%= dom_id(t)%>');
|
||||
<% end -%>
|
||||
});
|
||||
|
|
@ -171,18 +171,6 @@ end
|
|||
next_steps.go();
|
||||
}
|
||||
|
||||
function remove_source_container(next_steps) {
|
||||
<% if (@remaining_in_context == 0 && source_view_is_one_of(:todo, :tag))
|
||||
# remove context with deleted todo
|
||||
-%>
|
||||
$('#c<%=@todo.context_id%>').fadeOut(1000, function() {
|
||||
next_steps.go();
|
||||
});
|
||||
<% else %>
|
||||
next_steps.go();
|
||||
<% end %>
|
||||
}
|
||||
|
||||
function html_for_recurring_todo() {
|
||||
<%-
|
||||
js = @saved && @new_recurring_todo ? escape_javascript(render(:partial => @new_recurring_todo, :locals => { :parent_container_type => parent_container_type })) : ""
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ function update_badge_count() {
|
|||
|
||||
function insert_new_context_with_updated_todo(next_steps) {
|
||||
$('#display_box').prepend(html_for_new_context());
|
||||
$('#c<%= @todo.context_id %>').fadeIn(500, function() { next_steps.go(); });
|
||||
$('#<%= item_container_id(@todo) %>').fadeIn(500, function() { next_steps.go(); });
|
||||
}
|
||||
|
||||
function html_for_todo() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue