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
77
78
79
|
# File 'app/controllers/backlogs_controller.rb', line 77
def burn_down_chart
send_burn_down_chart 640
end
|
#burn_down_chart_thumbnail ⇒ Object
73
74
75
|
# File 'app/controllers/backlogs_controller.rb', line 73
def burn_down_chart_thumbnail
send_burn_down_chart 270
end
|
#create ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/backlogs_controller.rb', line 39
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
67
68
69
70
71
|
# File 'app/controllers/backlogs_controller.rb', line 67
def destroy
Backlog.find(params[:id]).destroy
flash[:notice] = 'Backlog was successfully deleted.'
redirect_to :action => 'index'
end
|
#edit ⇒ Object
49
50
51
52
53
54
55
|
# File 'app/controllers/backlogs_controller.rb', line 49
def edit
@backlog = Backlog.find(params[:id])
@tasks = @backlog.tasks.sort do |t1, t2|
(t1.position && (t2.position ? t1.position <=> t2.position : -1)) ||
(t2.position ? 1 : t1.finished_at <=> t2.finished_at)
end
end
|
#index ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/controllers/backlogs_controller.rb', line 8
def index
if Task.find_started(user).size > 0
redirect_to :controller => 'tasks', :action => :list_started
return
end
redirect_to :controller => 'periods', :action => :index
end
|
#new ⇒ Object
35
36
37
|
# File 'app/controllers/backlogs_controller.rb', line 35
def new
@backlog = Backlog.new
end
|
#show ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/backlogs_controller.rb', line 16
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
57
58
59
60
61
62
63
64
65
|
# File 'app/controllers/backlogs_controller.rb', line 57
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
|