66 lines
1.0 KiB
Ruby
66 lines
1.0 KiB
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class Admin::SComptaAccountsController < ApplicationController
|
|
layout "admin"
|
|
before_action :auth_admin
|
|
|
|
before_action :admin_space
|
|
|
|
def admin_space
|
|
@admin_space = "export_compta"
|
|
end
|
|
|
|
def index
|
|
@s_compta_accounts = SComptaAccount.order(:code).all
|
|
|
|
end
|
|
|
|
def show
|
|
@s_compta_account = SComptaAccount.find(params[:id])
|
|
|
|
end
|
|
|
|
def new
|
|
@s_compta_account = SComptaAccount.new
|
|
|
|
end
|
|
|
|
def edit
|
|
@s_compta_account = SComptaAccount.find(params[:id])
|
|
|
|
end
|
|
|
|
def create
|
|
@s_compta_account = SComptaAccount.new(params.require(:s_compta_account).permit!)
|
|
|
|
if @s_compta_account.save
|
|
|
|
else
|
|
render action: "new"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
def update
|
|
@s_compta_account = SComptaAccount.find(params[:id])
|
|
|
|
|
|
if @s_compta_account.update_attributes(params.require(:s_compta_account).permit!)
|
|
|
|
else
|
|
render action: "edit"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
def destroy
|
|
@s_compta_account = SComptaAccount.find(params[:id])
|
|
@s_compta_account.destroy
|
|
|
|
end
|
|
end
|