Class: StockStampersController
Constant Summary
FlashTruncation::STRING_OVERHEAD
Instance Method Summary
collapse
#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!
#max_flash_size, #truncate_flash, #truncate_flash_array
Instance Method Details
#create ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/stock_stampers_controller.rb', line 7
def create
@stock_stamper = StockStamper.new(stock_stamper_params)
if @stock_stamper.valid?
@stock_stamper.execute
flash.update(@stock_stamper.message)
flash.discard
else
flash.now[:error] = @stock_stamper.errors.full_messages
render :new
end
end
|
#generate_tecan_file ⇒ Object
19
20
21
22
23
24
|
# File 'app/controllers/stock_stampers_controller.rb', line 19
def generate_tecan_file
send_data params[:file_content],
type: 'text/plain',
filename: "stock_stamper_#{params[:plate_barcode]}.gwl",
disposition: 'attachment'
end
|
#new ⇒ Object
3
4
5
|
# File 'app/controllers/stock_stampers_controller.rb', line 3
def new
@stock_stamper = StockStamper.new
end
|
#print_label ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/stock_stampers_controller.rb', line 26
def print_label
print_job =
LabelPrinter::PrintJob.new(params[:printer], LabelPrinter::Label::AssetRedirect, printables: params[:printable])
if print_job.execute
flash[:notice] = print_job.success
else
flash[:error] = print_job.errors.full_messages.join('; ')
end
redirect_to new_stock_stamper_path
end
|
#stock_stamper_params ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/stock_stampers_controller.rb', line 37
def stock_stamper_params
params.require(:stock_stamper).permit(
:user_barcode,
:source_plate_barcode,
:source_plate_type_name,
:destination_plate_barcode,
:destination_plate_type_name,
:overage
)
end
|