Skip to content

Commit

Permalink
disable the agent delete button if the agent is used
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 27, 2023
1 parent b9bb256 commit 705dac5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/views/agents/_show_line.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
%span.mx-1
= link_to_agent_edit_modal(agent)
%span
= button_to "Delete", CGI.unescape(agent_path(agent.id.split('/').last)), method: :delete, class: 'btn btn-link', form: {data: { turbo: true, turbo_confirm: "Are you sure?", turbo_frame: '_top'}}
- if count.zero?
= button_to "Delete", CGI.unescape(agent_path(agent.id.split('/').last)), method: :delete, class: 'btn btn-link', form: {data: { turbo: true, turbo_confirm: "Are you sure?", turbo_frame: '_top'}}
- else
%span{data: { controller: 'tooltip' }, title: "Can't delete this #{agent.agentType} because still used"}
= link_to "Delete", "", class: 'btn btn-link disabled'

0 comments on commit 705dac5

Please sign in to comment.