Skip to content

Commit

Permalink
Remove the delete demarche feature for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoirenovel committed Oct 9, 2018
1 parent 3edff83 commit ce8181b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 105 deletions.
8 changes: 0 additions & 8 deletions app/controllers/admin/procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ def edit
@mine = @procedure.path_is_mine?(@path)
end

def hide
procedure = current_administrateur.procedures.find(params[:id])
procedure.hide!

flash.notice = "Démarche supprimée, en cas d'erreur #{helpers.contact_link('contactez nous', tags: 'démarche supprimée')}"
redirect_to admin_procedures_draft_path
end

def destroy
procedure = current_administrateur.procedures.find(params[:id])

Expand Down
25 changes: 0 additions & 25 deletions app/helpers/procedure_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,4 @@ def procedure_modal_text(procedure, key)
action = procedure.archivee? ? :reopen : :publish
t(action, scope: [:modal, :publish, key])
end

def dossiers_deletion_warning(procedure)
dossiers_count = procedure.dossiers.state_not_brouillon.count
brouillons_count = procedure.dossiers.state_brouillon.count
formatted_dossiers_count = nil
formatted_brouillons_count = nil

if dossiers_count > 0
formatted_dossiers_count = pluralize(dossiers_count, "dossier", "dossiers")
end

if brouillons_count > 0
formatted_brouillons_count = pluralize(brouillons_count, "brouillon", "brouillons")
end

formatted_combination = [formatted_dossiers_count, formatted_brouillons_count]
.compact
.join(" et ")

[
formatted_combination,
dossiers_count + brouillons_count == 1 ? "est rattaché" : "sont rattachés",
"à cette démarche, la suppression de cette démarche entrainera également leur suppression."
].join(" ")
end
end
20 changes: 0 additions & 20 deletions app/views/admin/procedures/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,3 @@
- else
.alert.alert-info
Cette démarche n’a pas encore de lien, et n’est donc pas accessible par le public.

%br

- if @procedure.publiee_ou_archivee?
%h3 Supprimer la démarche
.alert.alert-danger
%p
Attention : la suppression d’une démarche est définitive.

- dossiers_count = @procedure.dossiers.count
- if dossiers_count > 0
%p
= dossiers_deletion_warning(@procedure)

%p.text-right
= link_to "J'ai compris, je supprime la démarche",
hide_admin_procedure_path(@procedure),
method: :post,
class: "btn btn-danger",
data: { confirm: "Voulez-vous supprimer la démarche ?", disable: true }
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
end

member do
post :hide
delete :delete_logo
delete :delete_deliberation
delete :delete_notice
Expand Down
51 changes: 0 additions & 51 deletions spec/helpers/procedure_helper_spec.rb

This file was deleted.

0 comments on commit ce8181b

Please sign in to comment.