diff --git a/app/views/answer/show.haml b/app/views/answer/show.haml index f1096f09..c3e0453b 100644 --- a/app/views/answer/show.haml +++ b/app/views/answer/show.haml @@ -1,3 +1,3 @@ - provide(:title, answer_title(@answer)) .container.container--main - = render 'answerbox', a: @answer \ No newline at end of file + = render 'answerbox', a: @answer, display_all: @display_all diff --git a/app/views/application/_answerbox.haml b/app/views/application/_answerbox.haml index ed8a260d..77827c11 100644 --- a/app/views/application/_answerbox.haml +++ b/app/views/application/_answerbox.haml @@ -1,14 +1,14 @@ -.card.answerbox{data: { id: a.id, q_id: a.question.id }} +.card.answerbox{ data: { id: a.id, q_id: a.question.id } } - if @question.nil? - = render "answerbox/header", a: a + = render 'answerbox/header', a: a .card-body - - if @display_all.nil? + - if display_all.nil? .answerbox__answer-text = markdown a.content[0..255] - if a.content.length > 255 [...] %p - %a.btn.btn-primary{href: show_user_answer_path(a.user.screen_name, a.id)} + %a.btn.btn-primary{ href: show_user_answer_path(a.user.screen_name, a.id) } = t 'views.answerbox.read' - else .answerbox__answer-text @@ -18,15 +18,15 @@ .col.col-sm-4.col-md-6.text-left.text-muted .media .pull-left - %a{href: show_user_profile_path(a.user.screen_name)} - %img.answerbox__answer-user-avatar.avatar-sm{src: a.user.profile_picture.url(:medium)} + %a{ href: show_user_profile_path(a.user.screen_name) } + %img.answerbox__answer-user-avatar.avatar-sm{ src: a.user.profile_picture.url(:medium) } .media-body %h6.media-heading.answerbox__answer-user - = raw t('views.answerbox.answered', hide: hidespan(t('views.answerbox.hide'), "d-none d-sm-inline"), user: user_screen_name(a.user)) + = raw t('views.answerbox.answered', hide: hidespan(t('views.answerbox.hide'), 'd-none d-sm-inline'), user: user_screen_name(a.user)) .answerbox__answer-date = link_to(raw(t('views.answerbox.time', time: time_tooltip(a))), show_user_answer_path(a.user.screen_name, a.id)) .col.col-sm-8.col-md-6.text-right - = render 'answerbox/actions', a: a + = render 'answerbox/actions', a: a, display_all: display_all - else .row .col-4.col-sm-4.col-md-6.text-left.text-muted @@ -34,6 +34,6 @@ = link_to(raw(t('views.answerbox.time', time: time_tooltip(a))), show_user_answer_path(a.user.screen_name, a.id)) .col-8.col-sm-8.col-md-6.text-right = render 'answerbox/actions', a: a - .card-footer{id: "ab-comments-section-#{a.id}", style: @display_all.nil? ? 'display: none' : nil } - %div{id: "ab-smiles-#{a.id}"}= render 'answerbox/smiles', a: a - %div{id: "ab-comments-#{a.id}"}= render 'answerbox/comments', a: a \ No newline at end of file + .card-footer{ id: "ab-comments-section-#{a.id}", style: display_all.nil? ? 'display: none' : nil } + %div{ id: "ab-smiles-#{a.id}" }= render 'answerbox/smiles', a: a + %div{ id: "ab-comments-#{a.id}" }= render 'answerbox/comments', a: a diff --git a/app/views/application/_questionbox.haml b/app/views/application/_questionbox.haml index 78f0cd2d..23af423e 100644 --- a/app/views/application/_questionbox.haml +++ b/app/views/application/_questionbox.haml @@ -1,43 +1,46 @@ .card .card-header - - if @user.motivation_header.blank? + - if user.motivation_header.blank? = t 'views.questionbox.title' - else - = @user.motivation_header + = user.motivation_header .card-body - - if @user.banned? + - if user.banned? .text-center %strong= t 'views.questionbox.banned' - else - - if user_signed_in? or @user.privacy_allow_anonymous_questions? + - if user_signed_in? || user.privacy_allow_anonymous_questions? #question-box - %textarea.form-control{:name => "qb-question", :placeholder => t('views.placeholder.question')} - .row{:style => "padding-top: 5px; padding-left: 5px; padding-right: 5px;"} + %textarea.form-control{ name: 'qb-question', placeholder: t('views.placeholder.question') } + .row{ style: 'padding-top: 5px; padding-left: 5px; padding-right: 5px;' } .col-6 - if user_signed_in? - - if @user.privacy_allow_anonymous_questions? - %input{:name => "qb-anonymous", :type => "checkbox"}/ + - if user.privacy_allow_anonymous_questions? + %input{ name: 'qb-anonymous', type: :checkbox }/ = t 'views.actions.anonymous' %br/ - else - %input{:name => "qb-anonymous", :type => "hidden", :value => "false"}/ + %input{ name: 'qb-anonymous', type: :hidden, value: false }/ .col-6 %p.pull-right - %input{name: 'qb-to', type: 'hidden', :value => @user.id}/ - %button.btn.btn-primary{name: 'qb-ask', :type => "button", data: {loading_text: t('views.questionbox.load'), promote: user_signed_in? ? "false" : "true" }} Ask + %input{ name: 'qb-to', type: 'hidden', value: user.id }/ + %button.btn.btn-primary{ name: 'qb-ask', + type: :button, + data: { loading_text: t('views.questionbox.load'), promote: user_signed_in? ? 'false' : 'true' } } + Ask - unless user_signed_in? - - if @user.privacy_allow_anonymous_questions? - #question-box-promote{:style => "display: none;"} + - if user.privacy_allow_anonymous_questions? + #question-box-promote{ style: 'display: none;' } .row .col-12.text-center %strong= t 'views.questionbox.promote.message' .row .col-sm-5.offset-sm-1 - %button#create-account.btn.btn-block.btn-primary= t 'views.questionbox.promote.create' + %button.btn.btn-block.btn-primary#create-account= t 'views.questionbox.promote.create' .col-sm-5 - %button#new-question.btn.btn-block.btn-default= t 'views.questionbox.promote.another' + %button.btn.btn-block.btn-default#new-question= t 'views.questionbox.promote.another' .row .col-xs-12.col-sm-10.offset-sm-1.text-center %small= t('views.questionbox.promote.join', app_title: APP_CONFIG['site_name']) - else - %p= raw t 'views.questionbox.required', signup: link_to(t('views.sessions.new'),new_user_registration_path) + %p= raw t 'views.questionbox.required', signup: link_to(t('views.sessions.new'), new_user_registration_path) diff --git a/app/views/layouts/user/profile.haml b/app/views/layouts/user/profile.haml index 32db93f7..f33dfa8f 100644 --- a/app/views/layouts/user/profile.haml +++ b/app/views/layouts/user/profile.haml @@ -6,7 +6,7 @@ = render 'user/profile', user: @user .d-none.d-sm-block= render 'shared/links' .col-md-9.col-xs-12.col-sm-8 - = render 'questionbox' + = render 'questionbox', user: @user = render 'tabs/profile', user: @user = yield - if user_signed_in?