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


29
30
31
32
33
34
35
36
# File 'app/controllers/admin/robot_properties_controller.rb', line 29

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


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

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


38
39
40
# File 'app/controllers/admin/robot_properties_controller.rb', line 38

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

#find_robot_by_idObject


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

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

#indexObject


7
8
9
# File 'app/controllers/admin/robot_properties_controller.rb', line 7

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

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

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


11
12
13
# File 'app/controllers/admin/robot_properties_controller.rb', line 11

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

#updateObject


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

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