Class: BacklogsController
Constant Summary
Localization::LOCALIZED_STRINGS
Instance Method Summary
collapse
in_place_edit_for
#l, load_localized_strings, #valid_language?
Instance Method Details
#burn_down_chart ⇒ Object
96
97
98
|
# File 'app/controllers/backlogs_controller.rb', line 96
def burn_down_chart
send_burn_down_chart 640
end
|
#burn_down_chart_thumbnail ⇒ Object
92
93
94
|
# File 'app/controllers/backlogs_controller.rb', line 92
def burn_down_chart_thumbnail
send_burn_down_chart 270
end
|
#create ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/backlogs_controller.rb', line 47
def create
@backlog = Backlog.new(params[:backlog])
if @backlog.save
flash[:notice] = 'Backlog was successfully created.'
redirect_to :action => :show, :id => @backlog
else
render :action => 'new'
end
end
|
#destroy ⇒ Object
86
87
88
89
90
|
# File 'app/controllers/backlogs_controller.rb', line 86
def destroy
Backlog.find(params[:id]).destroy
flash[:notice] = 'Backlog was successfully deleted.'
redirect_to :action => 'index'
end
|
#edit ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'app/controllers/backlogs_controller.rb', line 57
def edit
@backlog = Backlog.find(params[:id])
unplanned_tasks = @backlog.tasks.select {|t| t.period.nil? && t.finished_at.nil?}.sort_by {|t| t.position}
planned_tasks = @backlog.tasks.select {|t| t.period && t.finished_at.nil?}.sort do |t1, t2|
if (cmp_period = t1.period.end_on <=> t2.period.end_on) != 0
cmp_period
else
t1.position <=> t2.position
end
end
@tasks = planned_tasks + unplanned_tasks
@completed_tasks = @backlog.tasks.select {|t| t.finished_at}.sort {|t1, t2| t1.finished_at <=> t2.finished_at}
end
|
#edit_no_layout ⇒ Object
71
72
73
74
|
# File 'app/controllers/backlogs_controller.rb', line 71
def edit_no_layout
edit
render :partial => 'tasks'
end
|
#index ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/backlogs_controller.rb', line 8
def index
if Task.find_started.size > 0
redirect_to :controller => 'tasks', :action => :list_started
return
end
if Backlog.count == 0
redirect_to :action => :new
return
end
redirect_to :controller => 'periods', :action => :index
end
|
#list ⇒ Object
20
21
22
|
# File 'app/controllers/backlogs_controller.rb', line 20
def list
@backlogs = Backlog.find(:all, :order => 'name')
end
|
#new ⇒ Object
43
44
45
|
# File 'app/controllers/backlogs_controller.rb', line 43
def new
@backlog = Backlog.new
end
|
#show ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/backlogs_controller.rb', line 24
def show
if params[:id]
@backlog = Backlog.find(params[:id])
end
unless @backlog
@backlog = Backlog.find(:first)
unless @backlog
redirect_to :controller => 'backlogs', :action => :new
return
end
end
@period = @backlog.first_active_period
unless @period
redirect_to :controller => 'periods', :action => :new, :backlog_id => @backlog.id
return
end
redirect_to :controller => 'periods', :action => :show, :id => @period
end
|
#update ⇒ Object
76
77
78
79
80
81
82
83
84
|
# File 'app/controllers/backlogs_controller.rb', line 76
def update
@backlog = Backlog.find(params[:id])
if @backlog.update_attributes(params[:backlog])
flash[:notice] = 'Backlog was successfully updated.'
redirect_to :action => 'show', :id => @backlog
else
render :action => 'edit'
end
end
|