origin pull master
This commit is contained in:
74
app/controllers/print_settings_controller.rb
Normal file
74
app/controllers/print_settings_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class PrintSettingsController < ApplicationController
|
||||
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, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user