demarches-normaliennes/app/controllers/admin/dossier_controller.rb

34 lines
893 B
Ruby
Raw Normal View History

2015-08-10 11:05:06 +02:00
class Admin::DossierController < ApplicationController
before_action :authenticate_user!
def show
@dossier = Dossier.find(params[:dossier_id])
@entreprise = @dossier.entreprise.decorate
@etablissement = @dossier.etablissement
@pieces_jointes = @dossier.pieces_jointes
2015-08-10 11:05:06 +02:00
@commentaires = @dossier.commentaires.order(created_at: :desc)
@commentaires = @commentaires.all.decorate
@commentaire_email = current_user.email
2015-08-14 14:05:09 +02:00
@formulaire = @dossier.formulaire
2015-08-10 11:05:06 +02:00
@dossier = @dossier.decorate
rescue ActiveRecord::RecordNotFound
2015-08-10 11:05:06 +02:00
redirect_start
end
def index
@dossier = Dossier.find(params[:dossier_id])
redirect_to url_for({controller: 'admin/dossier', action: :show, :dossier_id => @dossier.id})
rescue
redirect_start
end
private
def redirect_start
redirect_to url_for({controller: '/start', action: :error_dossier})
end
end