Don't allow to modify answer's videos for started polls

Same rules that will apply for the answer itself should apply for the
attachments like videos, images, and/or documents.
This commit is contained in:
Julian Herrero
2022-09-02 14:29:04 +02:00
committed by Javi Martín
parent 14542df0de
commit 5fe86264ca
8 changed files with 182 additions and 24 deletions

View File

@@ -6,9 +6,15 @@
<%= t("admin.answers.videos.index.title") %>
</h2>
<%= link_to t("admin.answers.videos.index.add_video"),
new_admin_answer_video_path(@answer),
class: "button success float-right" %>
<% if can?(:create, Poll::Question::Answer.new(question: @answer.question)) %>
<%= link_to t("admin.answers.videos.index.add_video"),
new_admin_answer_video_path(@answer),
class: "button success float-right" %>
<% else %>
<div class="callout warning">
<strong><%= t("admin.questions.no_edit") %></strong>
</div>
<% end %>
<div>
@@ -27,7 +33,7 @@
<td><%= video.title %></td>
<td><%= link_to video.url, video.url %></td>
<td>
<%= render Admin::TableActionsComponent.new(video) %>
<%= render Admin::Poll::Questions::Answers::Videos::TableActionsComponent.new(video) %>
</td>
</tr>
<% end %>