fatfreecrm/fat_free_crm

View on GitHub
app/views/tasks/complete.js.haml

Summary

Maintainability
Test Coverage
- if called_from_index_page? # Completing from pending tasks view -- fade out task partial and update sidebar.

  $('##{dom_id(@task, :tools)}').hide();
  $('##{dom_id(@task)}').fadeOut({ duration:500 });
  - if @empty_bucket
    $('#list_#{@empty_bucket}').fadeOut({ duration:500 });
  = refresh_sidebar(:index)

- else # Completing from the Asset page -- replace task partial with completed one.

  $('##{dom_id(@task)}').hide();
  $('##{dom_id(@task)}').html('#{ j render(partial: "tasks/completed", collection: [ @task ], locals: { bucket: nil }) }');
  $('##{dom_id(@task)}').fadeIn({ duration:500 });
  $('#recently').replaceWith('#{ j render(partial: "shared/recently") }');