module PeriodsHelper def remove_active_task(page) page.visual_effect :blind_up, "task_#{@task.id}" if @tasks.find {|t| t.backlog_id == @task.backlog_id}.nil? page["task_#{@task.id}"].ancestors.first.ancestors.first.remove else page.remove "task_#{@task.id}" end if @tasks.empty? page.visual_effect :blind_up, "active_tasks" page.visual_effect :appear, "no_tasks_message" end end def remove_finished_task(page) page.visual_effect :fade, "task_#{@task.id}" page.remove "task_#{@task.id}" if @last_finished page.select('#completed_tasks tr').first.remove end end def add_active_task(page) if @task.lower_item.nil? || @task.lower_item.backlog != @task.backlog page.insert_html :top, :active_tasks, '' elsif @task.lower_item page.select('#active_tasks table tr').first.remove page.select('#active_tasks table tr').first.remove end insert(page, render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }), '#active_tasks table') fields_header = render(:partial => '/tasks/fields_header', :locals => { :backlog => @task.backlog, :active => true } ) insert(page, fields_header, '#active_tasks table') insert(page, render(:partial => "/tasks/backlog_header", :locals => {:backlog => @task.backlog}), '#active_tasks table') page[:no_tasks_message].hide if @task.lower_item.nil? page.visual_effect :appear, "active_tasks" end page.visual_effect :appear, "task_#{@task.id}" end def add_finished_task(page) work_done = ! @completed_tasks.find {|t| t.total_done != 0}.nil? first_finished = @completed_tasks.find {|t| t.id != @task.id}.nil? unless first_finished page.select("#completed_tasks_#{@task.period_id} tr").first.remove else page.insert_html :top, "completed_tasks", "
" end page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false} page.visual_effect :appear, "task_#{@task.id}" page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done} end def update_burn_down_chart(page) page['burn_down_chart'].src = url_for(:controller => 'periods', :action => :burn_down_chart_thumbnail, :id => @task.period.id, :rnd => rand) end end