Class: Pixelpress::PrintersController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/pixelpress/printers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
# File 'app/controllers/pixelpress/printers_controller.rb', line 2

def index
  @printers = Pixelpress::Preview.all
end

#showObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/pixelpress/printers_controller.rb', line 6

def show
  klass = params[:printer_id]
  method = params[:id]
  printer = Pixelpress::Preview.all.map { |e| [e.printer_name, e] }.to_h[klass].send(method)
  respond_to do |format|
    format.html { render html: printer.html }
    format.pdf { send_data printer.pdf.read, disposition: 'inline', type: 'application/pdf' }
  end
end