Wire up Turbo Streams action calls in templates

This commit is contained in:
Andreas Nedbal 2022-11-21 22:30:15 +01:00
parent d000ddaae4
commit b81fbb7fe6
3 changed files with 6 additions and 6 deletions

View File

@ -8,11 +8,11 @@
%i.fa.fa-fw.fa-exclamation-triangle
= t("voc.report")
- if question.anonymous? && !question.generated?
%a.dropdown-item{ name: "ib-block-anon", data: { q_id: question.id } }
= button_to anonymous_block_path, method: :post, params: { question: question.id }, class: "dropdown-item" do
%i.fa.fa-fw.fa-minus-circle
= t("voc.block")
- if current_user.mod?
%a.dropdown-item{ href: "#", name: "mod-block-anon", data: { q_id: question.id } }
= button_to anonymous_block_path, method: :post, params: { question: question.id, global: true }, class: "dropdown-item" do
%i.fa.fa-fw.fa-volume-off
= t("voc.block_site_wide")
%a.dropdown-item{ href: moderation_questions_path(author_identifier: question.author_identifier) }

View File

@ -1,4 +1,4 @@
.card.inbox-entry{ class: i.new? ? "inbox-entry--new" : "", data: { id: i.id } }
.card.inbox-entry{ id: "inbox_#{i.id}", class: i.new? ? "inbox-entry--new" : "", data: { id: i.id } }
.card-header
.media
- unless i.question.author_is_anonymous

View File

@ -1,4 +1,4 @@
%li.list-group-item
%li.list-group-item{ id: "block_#{block.id}" }
.d-flex
%div
- if block.question.present?
@ -7,5 +7,5 @@
%p.mb-0.text-muted.font-italic= t(".deleted_question")
%p.text-muted.mb-0= t(".blocked", time: time_ago_in_words(block.created_at))
.ml-auto.d-inline-flex
%button.btn.btn-default.align-self-center{ data: { action: "anon-unblock", target: block.id } }
%span.pe-none= t("voc.unblock")
= button_to anonymous_block_path, method: :delete, params: { id: block.id }, class: "btn btn-default align-self-center" do
%span.pe-none= t("voc.unblock")