retrospring/app/views/question/_question.haml
Georg Gadinger 66efa5d4f4 clean up routes
- replace `match` with `get`/`post`/`patch`/`delete`
- format routes.rb
- rename the `show_user_{profile,question,answer}` routes to
  `profile`, `question`, `answer` so `url_for` (used by Rails Admin)
  works fine for these things
- also add `to_param` to the `User` model so that `url_for(some_user)`
  uses the user name
2022-07-23 12:14:06 +02:00

34 lines
2 KiB
Text

.card.question--fixed{ class: hidden ? 'question--hidden' : '', tabindex: hidden ? -1 : '', aria: { hidden: hidden } }
.container
.card-body
.media
- unless question.author_is_anonymous
%a.pull-left{ href: unless hidden then user_path(question.user) end }
%img.answerbox__question-user-avatar.avatar-md{ src: question.user.profile_picture.url(:medium) }
.media-body
- if user_signed_in?
.pull-right
.btn-group
%button.btn.btn-link.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } }
%span.caret
- unless hidden
.dropdown-menu.dropdown-menu-right{ role: :menu }
- if current_user.mod? || question.user == current_user
%a.dropdown-item.text-danger{ href: '#',
tabindex: -1,
data: { action: 'ab-question-destroy',
q_id: question.id,
redirect: question.author_is_anonymous? ? '/' : show_user_questions_path(question.user.screen_name) } }
%i.fa.fa-trash-o
= t 'views.actions.delete'
- unless question.user == current_user
%a.dropdown-item{ href: '#', tabindex: -1, data: { action: 'ab-question-report', q_id: question.id } }
%i.fa.fa-exclamation-triangle
= t 'views.actions.report'
%h6.text-muted.media-heading.answerbox__question-user
- identifier = question.author_is_anonymous ? question.author_identifier : nil
- if hidden
= user_screen_name question.user, author_identifier: identifier, url: false
- else
= raw t('views.answerbox.asked', user: user_screen_name(question.user, author_identifier: identifier), time: time_tooltip(question))
.answerbox__question-text= question_markdown question.content