heylium_app/app/controllers/admin/label_entreprises_controller.rb
Nicolas Bally 8e18de4077 initial
2016-08-03 00:22:29 +02:00

72 lines
1.2 KiB
Ruby
Executable File

# -*- encoding : utf-8 -*-
class Admin::LabelEntreprisesController < ApplicationController
layout "admin"
before_filter :auth_admin
def index
@label_entreprises = LabelEntreprise.all
end
def show
@label_entreprise = LabelEntreprise.find(params[:id])
end
def new
@label_entreprise = LabelEntreprise.new
end
def edit
@label_entreprise = LabelEntreprise.find(params[:id])
end
def create
@label_entreprise = LabelEntreprise.new(params.require(:label_entreprise).permit!)
if @label_entreprise.save
redirect_to admin_label_entreprises_url, notice: 'La pétition a été crée.'
else
render action: "new"
end
end
def update
@label_entreprise = LabelEntreprise.find(params[:id])
if @label_entreprise.update_attributes(params.require(:label_entreprise).permit!)
redirect_to admin_label_entreprises_url, notice: 'Les infos sur la pétition ont été mise à jour.'
else
render action: "edit"
end
end
def destroy
@label_entreprise = LabelEntreprise.find(params[:id])
@label_entreprise.destroy
redirect_to admin_label_entreprises_url
end
end