From b81fbb7fe6e6bf90e7c3df342a50abda131f256e Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Mon, 21 Nov 2022 22:30:15 +0100 Subject: [PATCH] Wire up Turbo Streams action calls in templates --- app/views/actions/_question.html.haml | 4 ++-- app/views/inbox/_entry.html.haml | 2 +- app/views/shared/_anonymous_block.html.haml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/actions/_question.html.haml b/app/views/actions/_question.html.haml index f82a1613..8e960655 100644 --- a/app/views/actions/_question.html.haml +++ b/app/views/actions/_question.html.haml @@ -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) } diff --git a/app/views/inbox/_entry.html.haml b/app/views/inbox/_entry.html.haml index 2a1b6e0b..25931da2 100644 --- a/app/views/inbox/_entry.html.haml +++ b/app/views/inbox/_entry.html.haml @@ -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 diff --git a/app/views/shared/_anonymous_block.html.haml b/app/views/shared/_anonymous_block.html.haml index 39cb20a9..e3e21349 100644 --- a/app/views/shared/_anonymous_block.html.haml +++ b/app/views/shared/_anonymous_block.html.haml @@ -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") \ No newline at end of file + = 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")