Class: Houston::Roadmaps::RoadmapsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/houston/roadmaps/roadmaps_controller.rb

Direct Known Subclasses

RoadmapMilestonesController

Instance Method Summary collapse

Instance Method Details

#createObject



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

#editObject



37
38
39
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 37

def edit
  authorize! :update, @roadmap
end

#historyObject



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

#indexObject



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

#newObject



52
53
54
55
# File 'app/controllers/houston/roadmaps/roadmaps_controller.rb', line 52

def new
  authorize! :create, Roadmap
  @roadmap = Roadmap.new
end

#showObject



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

#updateObject



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