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

33 lines
885 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])
2015-08-20 16:32:25 +02:00
redirect_to url_for(controller: 'admin/dossier', action: :show, dossier_id: @dossier.id)
2015-08-10 11:05:06 +02:00
rescue
redirect_start
end
private
def redirect_start
2015-08-20 16:32:25 +02:00
redirect_to url_for(controller: '/start', action: :error_dossier)
2015-08-10 11:05:06 +02:00
end
end