From f521b5f16073a28578fbe61b4343280b2050b695 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 21 Aug 2022 04:05:42 +0200 Subject: [PATCH] Implement moderation question view layout --- app/views/answerbox/_header.haml | 3 +++ app/views/moderation/questions/_header.haml | 6 ++++++ app/views/moderation/questions/index.haml | 8 ++++++++ config/locales/views.en.yml | 5 +++++ config/locales/voc.en.yml | 1 + 5 files changed, 23 insertions(+) create mode 100644 app/views/moderation/questions/_header.haml create mode 100644 app/views/moderation/questions/index.haml diff --git a/app/views/answerbox/_header.haml b/app/views/answerbox/_header.haml index 1d49f545..891dfe9c 100644 --- a/app/views/answerbox/_header.haml +++ b/app/views/answerbox/_header.haml @@ -19,6 +19,9 @@ %i.fa.fa-exclamation-triangle = t("voc.report") - if current_user.mod? && a.question.anonymous? && !a.question.generated? + %a.dropdown-item{ href: moderation_questions_path(author_identifier: a.question.author_identifier) } + %i.fa.fa-user-secret + = t("voc.show_anonymous_questions") %a.dropdown-item{ href: "#", name: "mod-block-anon", data: { q_id: a.question.id } } %i.fa.fa-volume-off = t("voc.block_site_wide") diff --git a/app/views/moderation/questions/_header.haml b/app/views/moderation/questions/_header.haml new file mode 100644 index 00000000..7ac62b46 --- /dev/null +++ b/app/views/moderation/questions/_header.haml @@ -0,0 +1,6 @@ +.card.question--fixed{ class: hidden ? 'question--hidden' : '', tabindex: hidden ? -1 : '', aria: { hidden: hidden } } + .container + .card-body + .media + .media-body + = t(".title_html", author_identifier: author_identifier, short: author_identifier.truncate(32)) \ No newline at end of file diff --git a/app/views/moderation/questions/index.haml b/app/views/moderation/questions/index.haml new file mode 100644 index 00000000..8f174ba0 --- /dev/null +++ b/app/views/moderation/questions/index.haml @@ -0,0 +1,8 @@ +- provide(:title, generate_title(t(".title", author_identifier: params[:author_identifier].truncate(32)))) + += render "header", author_identifier: params[:author_identifier], hidden: false += render "header", author_identifier: params[:author_identifier], hidden: true + +.container-lg.container--main + - @questions.each do |q| + = render 'shared/question', q: q, type: nil diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 66ad3f1e..b2a17b98 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -578,6 +578,11 @@ en: index: title: "Site-wide anonymous blocks" empty: "There are currently no users blocked site-wide." + questions: + header: + title_html: "Viewing all questions from
%{short}" + index: + title: "Questions from %{author_identifier}" user: actions: view_inbox: "View inbox" diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index fc15602f..020da213 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -13,6 +13,7 @@ en: login: "Sign in" logout: "Sign out" save: "Save changes" + show_anonymous_questions: "Show all questions from this user" register: "Sign up" report: "Report" terms: "Terms of Service"