Module: PeriodsHelper

Defined in:
app/helpers/periods_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_active_task(page) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'app/helpers/periods_helper.rb', line 23

def add_active_task(page)
  page.insert_html(:top, "active_tasks_#{@task.period.id}", render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }))
  
  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

#add_finished_task(page) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/helpers/periods_helper.rb', line 34

def add_finished_task(page)
  list_tag_id = "completed_tasks_#{@task.period_id}"
  work_done = ! @completed_tasks.find {|t| t.total_done != 0}.nil?
  first_finished = @completed_tasks.find {|t| t.id != @task.id}.nil?
  first_in_period = @completed_tasks.find {|t| t.period_id == @task.period_id && t.id != @task.id}.nil?
  if first_finished
    page.visual_effect :appear, "completed_tasks"
  end
  if first_in_period
    period_tag_id = "completed_period_#{@task.period_id}"
    page.insert_html :top, "completed_tasks", %Q{<div id="#{period_tag_id}" />}
    page.insert_html :top, period_tag_id, %Q{<ul id="#{list_tag_id}" class="task_list"/>}
    page.insert_html :top, period_tag_id, :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done}
  end
  page.insert_html :top, list_tag_id, :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false, :show_backlog => true}
  page.visual_effect :appear, "task_#{@task.id}"
  
end

#remove_active_task(page) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/helpers/periods_helper.rb', line 2

def remove_active_task(page)
  page.visual_effect :blind_up, "task_#{@task.id}"
  page.remove "task_#{@task.id}"
  
  if @tasks.empty?
    page.visual_effect :blind_up, "active_tasks"
    page.visual_effect :appear, "no_tasks_message"
  end
end

#remove_finished_task(page) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/periods_helper.rb', line 12

def remove_finished_task(page)
  page.visual_effect :fade, "task_#{@task.id}"
  page.remove "task_#{@task.id}"
  
  if @last_finished
    page.visual_effect :fade, "completed_period_#{@task.period_id}"
    page.remove "completed_period_#{@task.period_id}"
    page.visual_effect :fade, :completed_tasks
  end
end

#update_burn_down_chart(page) ⇒ Object



53
54
55
# File 'app/helpers/periods_helper.rb', line 53

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