76 lines
2.3 KiB
Ruby
76 lines
2.3 KiB
Ruby
class PrintSettingsController < ApplicationController
|
|
load_and_authorize_resource except: [:create]
|
|
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
|
|
|
# GET /print_settings
|
|
# GET /print_settings.json
|
|
def index
|
|
@print_settings = PrintSetting.all
|
|
end
|
|
|
|
# GET /print_settings/1
|
|
# GET /print_settings/1.json
|
|
def show
|
|
end
|
|
|
|
# GET /print_settings/new
|
|
def new
|
|
@print_setting = PrintSetting.new
|
|
end
|
|
|
|
# GET /print_settings/1/edit
|
|
def edit
|
|
end
|
|
|
|
# POST /print_settings
|
|
# POST /print_settings.json
|
|
def create
|
|
@print_setting = PrintSetting.new(print_setting_params)
|
|
|
|
respond_to do |format|
|
|
if @print_setting.save
|
|
format.html { redirect_to @print_setting, notice: 'Print setting was successfully created.' }
|
|
format.json { render :show, status: :created, location: @print_setting }
|
|
else
|
|
format.html { render :new }
|
|
format.json { render json: @print_setting.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# PATCH/PUT /print_settings/1
|
|
# PATCH/PUT /print_settings/1.json
|
|
def update
|
|
respond_to do |format|
|
|
if @print_setting.update(print_setting_params)
|
|
format.html { redirect_to @print_setting, notice: 'Print setting was successfully updated.' }
|
|
format.json { render :show, status: :ok, location: @print_setting }
|
|
else
|
|
format.html { render :edit }
|
|
format.json { render json: @print_setting.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# DELETE /print_settings/1
|
|
# DELETE /print_settings/1.json
|
|
def destroy
|
|
@print_setting.destroy
|
|
respond_to do |format|
|
|
format.html { redirect_to print_settings_url, notice: 'Print setting was successfully destroyed.' }
|
|
format.json { head :no_content }
|
|
end
|
|
end
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_print_setting
|
|
@print_setting = PrintSetting.find(params[:id])
|
|
end
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
def print_setting_params
|
|
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
|
end
|
|
end
|