This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/controllers/admin/price_lines_controller.rb
Nicolas Bally b09b941321 Amélioration interface saisie des prix par les fournisseurs.
Consulter le lien avec le token en navigation privée, épuration de l'affichage, méthodes dédiées...
2021-09-01 00:54:56 +02:00

66 lines
978 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::PriceLinesController < ApplicationController
layout "admin"
before_action :auth_admin, :except => [:edit, :update]
before_action :admin_space
def admin_space
@admin_space = "default"
end
def index
@price_lines = PriceLine.order(:name).all
end
def show
@price_line = PriceLine.find(params[:id])
end
def new
@price_line = PriceLine.new
end
def edit
@price_line = PriceLine.find(params[:id])
end
def create
@price_line = PriceLine.new(params.require(:price_line).permit!)
if @price_line.save
else
render action: "new"
end
end
def update
@price_line = PriceLine.find(params[:id])
if @price_line.update_attributes(params.require(:price_line).permit!)
else
render action: "edit"
end
end
def destroy
@price_line = PriceLine.find(params[:id])
@price_line.destroy
end
end