[#883] move admin part in backoffice

This commit is contained in:
Tanguy PATTE 2015-09-22 15:00:59 +02:00
parent 1238fdae23
commit 5ca014587a
17 changed files with 111 additions and 95 deletions

View file

@ -1,3 +0,0 @@
class Admin::CommentairesController < CommentairesController
before_action :authenticate_user!
end

View file

@ -0,0 +1,8 @@
class Backoffice::CommentairesController < CommentairesController
before_action :authenticate_gestionnaire!
def is_gestionnaire?
true
end
end

View file

@ -1,8 +1,8 @@
class Admin::DossierController < ApplicationController
class Backoffice::DossiersController < ApplicationController
before_action :authenticate_gestionnaire!
def show
@dossier = Dossier.find(params[:dossier_id])
@dossier = Dossier.find(params[:id])
@entreprise = @dossier.entreprise.decorate
@etablissement = @dossier.etablissement
@pieces_justificatives = @dossier.pieces_justificatives
@ -17,13 +17,6 @@ class Admin::DossierController < ApplicationController
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

View file

@ -7,10 +7,14 @@ class CommentairesController < ApplicationController
@commentaire.save
if request.referer.include? '/recapitulatif'
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: params['dossier_id'])
if is_gestionnaire?
redirect_to url_for(controller: 'backoffice/dossiers', action: :show, id: params['dossier_id'])
else
redirect_to url_for(controller: 'admin/dossier', action: :show, dossier_id: params['dossier_id'])
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: params['dossier_id'])
end
end
def is_gestionnaire?
false
end
end

View file

@ -1,3 +1,4 @@
#backoffice_dossier_show
%h1#dossier_id.text-info{ :style => 'text-align:right'}
= "Dossier n°#{@dossier.id}"

View file

@ -10,6 +10,7 @@
- @dossiers.each do |dossier|
%tr
%td= dossier.procedure.libelle
%td= dossier.nom_projet
%td
= link_to(dossier.nom_projet, "/backoffice/dossiers/#{dossier.id}")
%td Mise à jour
%td= dossier.last_update

View file

@ -31,13 +31,13 @@
%a{ href: "mailto:#{@dossier.mail_contact}" }
= @dossier.mail_contact
-if !request.url.include?('admin')
.col-lg-6.col-md-6
%br
%br
%a#modif_carte{href: "/dossiers/#{@dossier.id}/carte?back_url=recapitulatif"} Modifier la localisation
%br
%a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description
/ -if !request.url.include?('admin')
.col-lg-6.col-md-6
%br
%br
%a#modif_carte{href: "/dossiers/#{@dossier.id}/carte?back_url=recapitulatif"} Modifier la localisation
%br
%a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description
.col-md-6
= pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande})