Class: Admin::RobotPropertiesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/robot_properties_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
# File 'app/controllers/admin/robot_properties_controller.rb', line 32

def create
  @robot_property = @robot.robot_properties.build(params[:robot_property])
  if @robot_property.save
    redirect_to [:admin, @robot, @robot_property]
  else
    render action: 'new'
  end
end

#destroyObject



50
51
52
53
54
55
56
57
# File 'app/controllers/admin/robot_properties_controller.rb', line 50

def destroy
  @robot_property = RobotProperty.find(params[:id])
  @robot_property.destroy
  respond_to do |format|
    format.html { redirect_to admin_robot_robot_properties_path(@robot) }
    format.xml { head :ok }
  end
end

#editObject



29
30
31
# File 'app/controllers/admin/robot_properties_controller.rb', line 29

def edit
  @robot_property = @robot.robot_properties.find(params[:id])
end

#find_robot_by_idObject



59
60
61
# File 'app/controllers/admin/robot_properties_controller.rb', line 59

def find_robot_by_id
  @robot = Robot.find(params[:robot_id])
end

#indexObject



9
10
11
# File 'app/controllers/admin/robot_properties_controller.rb', line 9

def index
  @robot_properties = @robot.robot_properties
end

#newObject



25
26
27
# File 'app/controllers/admin/robot_properties_controller.rb', line 25

def new
  @robot_property = @robot.robot_properties.build
end


17
18
19
20
21
22
23
# File 'app/controllers/admin/robot_properties_controller.rb', line 17

def print_labels
  @robot_property = @robot.robot_properties.beds.find(params[:id])
  if LabelPrinter::PrintJob.new(params[:printer], LabelPrinter::Label::RobotBeds, [@robot_property]).execute
    flash[:now] = 'The barcode for the bed was correctly printed'
  end
  redirect_to [:admin, @robot, @robot_property]
end

#showObject



13
14
15
# File 'app/controllers/admin/robot_properties_controller.rb', line 13

def show
  @robot_property = @robot.robot_properties.find(params[:id])
end

#updateObject



41
42
43
44
45
46
47
48
# File 'app/controllers/admin/robot_properties_controller.rb', line 41

def update
  @robot_property = RobotProperty.find(params[:id])
  if @robot_property.update(params[:robot_property])
    redirect_to [:admin, @robot, @robot_property]
  else
    render action: 'edit'
  end
end