Class: IterationsController

Inherits:
ApplicationController show all
Defined in:
lib/branston/app/controllers/iterations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /iterations POST /iterations.xml



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/branston/app/controllers/iterations_controller.rb', line 70

def create
  @iteration = Iteration.new(params[:iteration])

  respond_to do |format|
    if @iteration.save
      flash[:notice] = 'Iteration was successfully created.'
      format.html { redirect_to iterations_path }
      format.xml  { render :xml => @iteration, :status => :created, :location => @iteration }
    else
      @releases = Release.all
      format.html { render :action => "new" }
      format.xml  { render :xml => @iteration.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /iterations/1 DELETE /iterations/1.xml



106
107
108
109
110
111
112
113
114
# File 'lib/branston/app/controllers/iterations_controller.rb', line 106

def destroy
  @iteration = Iteration.find(params[:id])
  @iteration.destroy

  respond_to do |format|
    format.html { redirect_to(iterations_url) }
    format.xml  { head :ok }
  end
end

#editObject

GET /iterations/1/edit



63
64
65
66
# File 'lib/branston/app/controllers/iterations_controller.rb', line 63

def edit
  @releases = Release.all
  @iteration = Iteration.find(params[:id])
end

#indexObject

GET /iterations GET /iterations.xml



28
29
30
31
32
33
34
35
# File 'lib/branston/app/controllers/iterations_controller.rb', line 28

def index
  @iterations = Iteration.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @iterations }
  end
end

#newObject

GET /iterations/new GET /iterations/new.xml



52
53
54
55
56
57
58
59
60
# File 'lib/branston/app/controllers/iterations_controller.rb', line 52

def new
  @releases = Release.all
  @iteration = Iteration.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @iteration }
  end
end

#showObject

GET /iterations/1 GET /iterations/1.xml



39
40
41
42
43
44
45
46
47
48
# File 'lib/branston/app/controllers/iterations_controller.rb', line 39

def show
  @iteration = Iteration.find(params[:id])

  @iteration_data = @iteration.burndown_data

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @iteration }
  end
end

#updateObject

PUT /iterations/1 PUT /iterations/1.xml



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/branston/app/controllers/iterations_controller.rb', line 88

def update
  @iteration = Iteration.find(params[:id])

  respond_to do |format|
    if @iteration.update_attributes(params[:iteration])
      flash[:notice] = 'Iteration was successfully updated.'
      format.html { redirect_to iterations_path }
      format.xml  { head :ok }
    else
      @releases = Release.all
      format.html { render :action => "edit" }
      format.xml  { render :xml => @iteration.errors, :status => :unprocessable_entity }
    end
  end
end