Class: Houston::Roadmaps::RoadmapsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Houston::Roadmaps::RoadmapsController
show all
- Defined in:
- app/controllers/houston/roadmaps/roadmaps_controller.rb
Instance Method Summary
collapse
Instance Method Details
#create ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 58
def create
authorize! :create, Roadmap
@roadmap = Roadmap.create params[:roadmap]
if @roadmap.persisted?
redirect_to roadmaps_url, notice: "Roadmap created"
else
render action: :new
end
end
|
#edit ⇒ Object
37
38
39
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 37
def edit
authorize! :update, @roadmap
end
|
#history ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 25
def history
authorize! :read, @roadmap
@title = "#{@roadmap.name} History"
@commits = @roadmap.commits.order(created_at: :desc)
@commit_id = params[:commit_id].to_i
@milestones = @roadmap.milestones.including_destroyed
@markers = Houston::Roadmaps.config.markers
end
|
#index ⇒ Object
8
9
10
11
12
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 8
def index
authorize! :read, Roadmap
@title = "Roadmaps"
@roadmaps = Roadmap.all.preload(:projects, :milestones => {:milestone => :project}).order(:name)
end
|
#new ⇒ Object
52
53
54
55
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 52
def new
authorize! :create, Roadmap
@roadmap = Roadmap.new
end
|
#show ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 15
def show
authorize! :read, @roadmap
@title = @roadmap.name
@goals = @roadmap.projects.goals
@milestones = @roadmap.milestones
render template: "houston/roadmaps/roadmaps/show_editable" if can?(:update, @roadmap)
end
|
#update ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 42
def update
authorize! :update, @roadmap
if @roadmap.update_attributes params[:roadmap]
redirect_to roadmaps_url, notice: "Roadmap created"
else
render action: :edit
end
end
|