better button
This commit is contained in:
parent
f166077f5e
commit
af436500fd
2 changed files with 2 additions and 4 deletions
|
@ -37,7 +37,7 @@ module Manager
|
||||||
administrateur = Administrateur.find(params[:id])
|
administrateur = Administrateur.find(params[:id])
|
||||||
|
|
||||||
if !administrateur.can_be_deleted?
|
if !administrateur.can_be_deleted?
|
||||||
fail "Cannot delete this administrateur because it has dossiers or procedures"
|
fail "Impossible de supprimer cet administrateur car il a des dossiers ou des procédures"
|
||||||
end
|
end
|
||||||
administrateur.dossiers.each(&:delete_and_keep_track)
|
administrateur.dossiers.each(&:delete_and_keep_track)
|
||||||
administrateur.destroy
|
administrateur.destroy
|
||||||
|
|
|
@ -33,12 +33,10 @@ as well as a link to its edit page.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<% if page.resource.can_be_deleted? %>
|
|
||||||
<%= link_to "supprimer", delete_manager_administrateur_path(page.resource), method: :delete, class: "button", data: { confirm: "Confirmez-vous la suppression de l'administrateur ?" } %>
|
|
||||||
<% end %>
|
|
||||||
<% if page.resource.invitation_expired? %>
|
<% if page.resource.invitation_expired? %>
|
||||||
<%= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button" %>
|
<%= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= button_to "supprimer", delete_manager_administrateur_path(page.resource), method: :delete, disabled: !page.resource.can_be_deleted?, class: "button", data: { confirm: "Confirmez-vous la suppression de l'administrateur ?" }, title: page.resource.can_be_deleted? ? "Supprimer" : "Cet administrateur a des dossiers ou des procédures et ne peut être supprimé" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
|
|
Loading…
Reference in a new issue