78 lines
957 B
Ruby
78 lines
957 B
Ruby
# -*- encoding : utf-8 -*-
|
|
class Admin::InscritsController < ApplicationController
|
|
before_filter :authenticate_admin!
|
|
|
|
|
|
layout "admin"
|
|
navigation :inscrits
|
|
before_filter :find_inscrits
|
|
|
|
|
|
def index
|
|
|
|
end
|
|
|
|
def cible
|
|
@inscrits = Inscrit.all
|
|
|
|
render :layout => false
|
|
|
|
end
|
|
|
|
def new
|
|
@inscrit = Inscrit.new
|
|
|
|
end
|
|
|
|
def edit
|
|
@inscrit = Inscrit.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
def create
|
|
@inscrit = Inscrit.new(params[:inscrit])
|
|
|
|
|
|
if @inscrit.save
|
|
flash[:notice] = "L'inscrit a bien été ajouté."
|
|
self.find_inscrits
|
|
|
|
else
|
|
render :action => "new"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
def update
|
|
@inscrit = Inscrit.find(params[:id])
|
|
|
|
if @inscrit.update_attributes(params[:inscrit])
|
|
flash[:notice] = "L'inscrit a bien été modifié."
|
|
|
|
else
|
|
render :action => "edit"
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
def destroy
|
|
@inscrit = Inscrit.find(params[:id])
|
|
@inscrit.destroy
|
|
|
|
end
|
|
|
|
protected
|
|
|
|
def find_inscrits
|
|
@inscrits = Inscrit.all
|
|
end
|
|
|
|
|
|
|
|
end
|