Retrospring/app/views/application/_questionbox.html.haml

64 lines
2.9 KiB
Plaintext

.card
.card-header
- if user.profile.motivation_header.blank?
= t(".title")
- else
= user.profile.motivation_header
.card-body
- if user.banned?
.text-center
%strong= t(".status.banned")
- elsif user_signed_in? && current_user.blocking?(user)
.text-center
%strong= t(".status.blocking")
- elsif user_signed_in? && user.blocking?(current_user)
.text-center
%strong= t(".status.blocked")
- elsif user.inbox_locked?
.text-center
%strong= t(".status.locked")
- elsif !user_signed_in? && user.privacy_require_user?
.text-center
%strong= t(".status.require_user_html", sign_in: link_to(t("voc.login"), new_user_session_path), sign_up: link_to(t("voc.register"), new_user_registration_path))
- else
- if user_signed_in? || user.privacy_allow_anonymous_questions?
#question-box{ data: user.profile.allow_long_questions ? {} : { controller: "character-count", "character-count-max-value": user.profile.question_length_limit }}
%textarea.form-control{ name: "qb-question", placeholder: t(".placeholder"), data: { "character-count-target": "input" } }
.row{ style: "padding-top: 5px;" }
.col-6
- if user_signed_in?
- if user.privacy_allow_anonymous_questions?
%label
%input{ name: "qb-anonymous", type: :checkbox }
= t(".anonymous")
%br/
- else
%input{ name: "qb-anonymous", type: :hidden, value: false }/
.col-6
%p.pull-right
%span.text-muted.me-1{ class: user.profile.allow_long_questions ? "d-none" : "", data: { "character-count-target": "counter" } }= Question::SHORT_QUESTION_MAX_LENGTH
%input{ name: "qb-to", type: "hidden", value: user.id }/
%button.btn.btn-primary{ name: "qb-ask",
type: :button,
data: { loading_text: t(".load"), promote: user_signed_in? ? "false" : "true", "character-count-target": "action" } }
Ask
- unless user_signed_in?
- if user.privacy_allow_anonymous_questions?
.d-none#question-box-promote
.row
.col-12.text-center
%strong= t(".promote.message")
.row
.col-sm-5.offset-sm-1
.d-grid
%button.btn.btn-primary#create-account= t(".promote.create")
.col-sm-5
.d-grid
%button.btn.btn-default#new-question= t(".promote.another")
.row
.col-xs-12.col-sm-10.offset-sm-1.text-center
%small= t(".promote.join", app_title: APP_CONFIG["site_name"])
- else
.text-center
%strong= t(".status.non_anonymous_html", sign_in: link_to(t("voc.login"), new_user_session_path), sign_up: link_to(t("voc.register"), new_user_registration_path))