Remove a now useless facade
This commit is contained in:
parent
cccad7dbdf
commit
6b1ab9b552
5 changed files with 23 additions and 54 deletions
|
@ -36,7 +36,6 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@facade = AdminProceduresShowFacades.new @procedure.decorate
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
class AdminProceduresShowFacades
|
|
||||||
def initialize(procedure)
|
|
||||||
@procedure = procedure
|
|
||||||
end
|
|
||||||
|
|
||||||
def procedure
|
|
||||||
@procedure
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,17 +1,15 @@
|
||||||
- procedure = @facade.procedure
|
|
||||||
|
|
||||||
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
||||||
.row.white-back
|
.row.white-back
|
||||||
#procedure_show
|
#procedure_show
|
||||||
= render partial: '/admin/procedures/modal_publish'
|
= render partial: '/admin/procedures/modal_publish'
|
||||||
= render partial: '/admin/procedures/modal_transfer'
|
= render partial: '/admin/procedures/modal_transfer'
|
||||||
|
|
||||||
- if procedure.brouillon?
|
- if @procedure.brouillon?
|
||||||
- if procedure.gestionnaires.empty? || procedure.service.nil?
|
- if @procedure.gestionnaires.empty? || @procedure.service.nil?
|
||||||
- missing_elements = []
|
- missing_elements = []
|
||||||
- if procedure.gestionnaires.empty?
|
- if @procedure.gestionnaires.empty?
|
||||||
- missing_elements << 'des accompagnateurs'
|
- missing_elements << 'des accompagnateurs'
|
||||||
- if procedure.service.nil?
|
- if @procedure.service.nil?
|
||||||
- missing_elements << 'un service'
|
- missing_elements << 'un service'
|
||||||
- message = "Affectez #{missing_elements.join(' et ')} à votre procédure."
|
- message = "Affectez #{missing_elements.join(' et ')} à votre procédure."
|
||||||
%a.action_button.btn.btn-success#disabled-publish-procedure{ data: { toggle: :tooltip, placement: :bottom }, style: 'float: right; margin-top: 10px;', disabled: true, title: message }
|
%a.action_button.btn.btn-success#disabled-publish-procedure{ data: { toggle: :tooltip, placement: :bottom }, style: 'float: right; margin-top: 10px;', disabled: true, title: message }
|
||||||
|
@ -26,13 +24,13 @@
|
||||||
%i.fa.fa-exchange
|
%i.fa.fa-exchange
|
||||||
Envoyer une copie
|
Envoyer une copie
|
||||||
|
|
||||||
- if procedure.archivee?
|
- if @procedure.archivee?
|
||||||
%a.btn.btn-default#reopen-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
|
%a.btn.btn-default#reopen-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
|
||||||
%i.fa.fa-rocket
|
%i.fa.fa-rocket
|
||||||
Réactiver
|
Réactiver
|
||||||
|
|
||||||
- elsif procedure.publiee?
|
- elsif @procedure.publiee?
|
||||||
= form_tag admin_procedure_archive_path(procedure_id: procedure.id), method: :put, style: 'float: right; margin-top: 10px;' do
|
= form_tag admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, style: 'float: right; margin-top: 10px;' do
|
||||||
%button#archive-procedure.btn.btn-small.btn-default.text-info{ type: :button }
|
%button#archive-procedure.btn.btn-small.btn-default.text-info{ type: :button }
|
||||||
%i.fa.fa-eraser
|
%i.fa.fa-eraser
|
||||||
Archiver
|
Archiver
|
||||||
|
@ -44,7 +42,7 @@
|
||||||
%i.fa.fa-remove
|
%i.fa.fa-remove
|
||||||
Annuler
|
Annuler
|
||||||
|
|
||||||
- if procedure.locked?
|
- if @procedure.locked?
|
||||||
#procedure_locked
|
#procedure_locked
|
||||||
.alert.alert-info
|
.alert.alert-info
|
||||||
Cette procédure a été publiée, certains éléments ne peuvent plus être modifiés.
|
Cette procédure a été publiée, certains éléments ne peuvent plus être modifiés.
|
||||||
|
@ -52,11 +50,11 @@
|
||||||
%div
|
%div
|
||||||
%h3 Lien procédure
|
%h3 Lien procédure
|
||||||
%div{ style: 'margin-left: 3%;' }
|
%div{ style: 'margin-left: 3%;' }
|
||||||
- if procedure.archivee?
|
- if @procedure.archivee?
|
||||||
%b
|
%b
|
||||||
Cette procédure est archivée et n’est donc pas accessible par le public.
|
Cette procédure est archivée et n’est donc pas accessible par le public.
|
||||||
- elsif procedure.brouillon_avec_lien? || procedure.publiee?
|
- elsif @procedure.brouillon_avec_lien? || @procedure.publiee?
|
||||||
= link_to procedure_lien(procedure), sanitize_url(procedure_lien(procedure)), target: :blank
|
= link_to procedure_lien(@procedure), sanitize_url(procedure_lien(@procedure)), target: :blank
|
||||||
- else
|
- else
|
||||||
%b
|
%b
|
||||||
Cette procédure n’a pas encore de lien, et n’est donc pas accessible par le public.
|
Cette procédure n’a pas encore de lien, et n’est donc pas accessible par le public.
|
||||||
|
@ -67,38 +65,38 @@
|
||||||
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
||||||
.description.col-xs-6.col-md-3.procedure-description
|
.description.col-xs-6.col-md-3.procedure-description
|
||||||
%h4.text-info
|
%h4.text-info
|
||||||
= procedure.libelle
|
= @procedure.libelle
|
||||||
|
|
||||||
= h string_to_html(procedure.description)
|
= h string_to_html(@procedure.description)
|
||||||
|
|
||||||
.champs.col-xs-6.col-md-3
|
.champs.col-xs-6.col-md-3
|
||||||
%h4.text-info
|
%h4.text-info
|
||||||
Champs
|
Champs
|
||||||
.badge.progress-bar-info
|
.badge.progress-bar-info
|
||||||
= procedure.types_de_champ.size
|
= @procedure.types_de_champ.size
|
||||||
%ul
|
%ul
|
||||||
- procedure.types_de_champ.order(:order_place).each do |champ|
|
- @procedure.types_de_champ.order(:order_place).each do |champ|
|
||||||
%li= champ.libelle
|
%li= champ.libelle
|
||||||
|
|
||||||
.champs_private.col-xs-6.col-md-3
|
.champs_private.col-xs-6.col-md-3
|
||||||
%h4.text-info
|
%h4.text-info
|
||||||
Annotations privées
|
Annotations privées
|
||||||
.badge.progress-bar-info
|
.badge.progress-bar-info
|
||||||
= procedure.types_de_champ_private.size
|
= @procedure.types_de_champ_private.size
|
||||||
%ul
|
%ul
|
||||||
- procedure.types_de_champ_private.order(:order_place).each do |champ|
|
- @procedure.types_de_champ_private.order(:order_place).each do |champ|
|
||||||
%li= champ.libelle
|
%li= champ.libelle
|
||||||
|
|
||||||
.pieces-justificatives.col-xs-6.col-md-3
|
.pieces-justificatives.col-xs-6.col-md-3
|
||||||
%h4.text-info
|
%h4.text-info
|
||||||
Pièces jointes
|
Pièces jointes
|
||||||
.badge.progress-bar-info
|
.badge.progress-bar-info
|
||||||
= procedure.types_de_piece_justificative.size
|
= @procedure.types_de_piece_justificative.size
|
||||||
- procedure.types_de_piece_justificative.each do |piece_justificative|
|
- @procedure.types_de_piece_justificative.each do |piece_justificative|
|
||||||
= piece_justificative.libelle
|
= piece_justificative.libelle
|
||||||
%br
|
%br
|
||||||
|
|
||||||
- durees_de_conservation = politiques_conservation_de_donnees(procedure)
|
- durees_de_conservation = politiques_conservation_de_donnees(@procedure)
|
||||||
- if durees_de_conservation.present?
|
- if durees_de_conservation.present?
|
||||||
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
||||||
.col-xs-6.col-md-3
|
.col-xs-6.col-md-3
|
||||||
|
@ -106,19 +104,19 @@
|
||||||
- durees_de_conservation.each do |text|
|
- durees_de_conservation.each do |text|
|
||||||
%p= text
|
%p= text
|
||||||
|
|
||||||
- if procedure.publiee_ou_archivee?
|
- if @procedure.publiee_ou_archivee?
|
||||||
%h3 Supprimer la procédure
|
%h3 Supprimer la procédure
|
||||||
.alert.alert-danger
|
.alert.alert-danger
|
||||||
%p
|
%p
|
||||||
Attention : la suppression d’une procédure est définitive.
|
Attention : la suppression d’une procédure est définitive.
|
||||||
- dossiers_count = procedure.dossiers.count
|
- dossiers_count = @procedure.dossiers.count
|
||||||
- if dossiers_count > 0
|
- if dossiers_count > 0
|
||||||
%p
|
%p
|
||||||
= pluralize(dossiers_count, "dossier est rattaché", "dossiers sont rattachés")
|
= pluralize(dossiers_count, "dossier est rattaché", "dossiers sont rattachés")
|
||||||
à cette procédure, la suppression de cette procédure entrainera également leur suppression.
|
à cette procédure, la suppression de cette procédure entrainera également leur suppression.
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= link_to "J'ai compris, je supprime la procédure",
|
= link_to "J'ai compris, je supprime la procédure",
|
||||||
hide_admin_procedure_path(procedure),
|
hide_admin_procedure_path(@procedure),
|
||||||
method: :post,
|
method: :post,
|
||||||
class: "btn btn-danger",
|
class: "btn btn-danger",
|
||||||
data: { confirm: "Voulez-vous supprimer la procédure ?", disable: true }
|
data: { confirm: "Voulez-vous supprimer la procédure ?", disable: true }
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe AdminProceduresShowFacades do
|
|
||||||
let!(:procedure) { create(:procedure) }
|
|
||||||
|
|
||||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'brouillon') }
|
|
||||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
|
||||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
|
||||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'en_construction') }
|
|
||||||
|
|
||||||
subject { AdminProceduresShowFacades.new procedure }
|
|
||||||
|
|
||||||
describe '#procedure' do
|
|
||||||
subject { super().procedure }
|
|
||||||
|
|
||||||
it { is_expected.to eq(procedure) }
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -5,7 +5,6 @@ describe 'admin/procedures/show.html.haml', type: :view do
|
||||||
let(:procedure) { create(:procedure, :with_service, archived_at: archived_at) }
|
let(:procedure) { create(:procedure, :with_service, archived_at: archived_at) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
assign(:facade, AdminProceduresShowFacades.new(procedure.decorate))
|
|
||||||
assign(:procedure, procedure)
|
assign(:procedure, procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue