Class: Tim::TargetImagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tim/target_images_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#render_not_found

Instance Method Details

#createObject



27
28
29
30
31
32
33
# File 'app/controllers/tim/target_images_controller.rb', line 27

def create
  @target_image = TargetImage.new(params[:target_image]) unless defined? @target_image
  if @target_image.save
    flash[:notice] = 'Image version was successfully created.'
  end
  respond_with @target_image
end

#destroyObject

DELETE /target_images/1 DELETE /target_images/1.xml



45
46
47
48
49
# File 'app/controllers/tim/target_images_controller.rb', line 45

def destroy
  @target_image = Tim::TargetImage.find(params[:id]) unless defined? @target_image
  @target_image.destroy
  respond_with @target_image
end

#editObject



22
23
24
25
# File 'app/controllers/tim/target_images_controller.rb', line 22

def edit
  @target_image = Tim::TargetImage.find(params[:id]) unless defined? @target_image
  respond_with @target_image
end

#factory_keysObject

TODO Add factory permission check



52
53
54
55
56
57
58
# File 'app/controllers/tim/target_images_controller.rb', line 52

def factory_keys
  if params[:target_image][:percent_complete] && params[:target_image][:status_detail][:activity]
    params[:target_image] = { :progress => params[:target_image][:percent_complete],
                              :status_detail => params[:target_image][:status_detail][:activity],
                              :status => params[:target_image][:status] }
  end
end

#indexObject



7
8
9
10
# File 'app/controllers/tim/target_images_controller.rb', line 7

def index
  @target_images = Tim::TargetImage.all unless defined? @target_images
  respond_with @target_images
end

#newObject



17
18
19
20
# File 'app/controllers/tim/target_images_controller.rb', line 17

def new
  @target_image = Tim::TargetImage.new unless defined? @target_image
  respond_with @target_image
end

#showObject



12
13
14
15
# File 'app/controllers/tim/target_images_controller.rb', line 12

def show
  @target_image = Tim::TargetImage.find(params[:id]) unless defined? @target_image
  respond_with @target_image
end

#updateObject



35
36
37
38
39
40
41
# File 'app/controllers/tim/target_images_controller.rb', line 35

def update
  @target_image = Tim::TargetImage.find(params[:id]) unless defined? @target_image
  if @target_image.update_attributes(params[:target_image])
    flash[:notice] = 'Target image was successfully updated.'
  end
  respond_with @target_image
end