Added acces rules for jobs, operator/jobs and admin/dashboard view, including lazy loading for cancel button in broadcasts

This commit is contained in:
2024-09-13 14:27:50 +02:00
parent 64289d045d
commit 418b41556e
19 changed files with 145 additions and 11 deletions

View File

@@ -54,10 +54,15 @@
</span>
</td>
<td class="p-2 py-3 text-right">
<% if job.open? %>
<%= button_to icon("x-circle", class: "icon size-10 text-hsrm-red", title: "Abbrechen"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %>
<% # TODO: Refactor to helper function %>
<% if defined?(no_turbo_stream) && no_turbo_stream %>
<%= turbo_frame_tag dom_id(job, :cancel_button) do %>
<%= render partial: "jobs/cancel_button", locals: { job: job } %>
<% end %>
<% else %>
<%= icon("x-circle", class: "icon icon-disabled size-10", title: "Kann nicht mehr abgebrochen werden") %>
<%= turbo_frame_tag dom_id(job, :cancel_button), src: cancel_button_job_path(job), loading: 'lazy' do %>
<%= icon("ellipsis-horizontal-circle", class: "icon icon-disabled size-10", title: "Loading...") %>
<% end %>
<% end %>
</td>
</tr>