From 0ba88942de789c5ebf34920cef3035745cea7b74 Mon Sep 17 00:00:00 2001 From: Yuki Date: Wed, 13 May 2015 00:18:06 +0530 Subject: [PATCH] Fix question headers overflowing into the answers --- app/assets/stylesheets/base.css.scss | 10 -------- app/assets/stylesheets/scss/panel.scss | 7 ++++++ app/views/question/show.html.haml | 33 ++------------------------ app/views/shared/_question_header.haml | 33 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 app/views/shared/_question_header.haml diff --git a/app/assets/stylesheets/base.css.scss b/app/assets/stylesheets/base.css.scss index 92c82f35..a15d5eec 100644 --- a/app/assets/stylesheets/base.css.scss +++ b/app/assets/stylesheets/base.css.scss @@ -20,16 +20,6 @@ body { padding-top: 30px; } -.question-page { - padding-top: 100px; -} - -@media(max-width: $screen-xs-max) { - .question-page { - padding-top: 130px; - } -} - .centre { text-align: center; } diff --git a/app/assets/stylesheets/scss/panel.scss b/app/assets/stylesheets/scss/panel.scss index b54f8e4e..91c39e4f 100644 --- a/app/assets/stylesheets/scss/panel.scss +++ b/app/assets/stylesheets/scss/panel.scss @@ -27,6 +27,13 @@ border-color: #fff; } +.panel-question.question-hidden { + visibility: hidden; + position: relative; + box-shadow: none; + z-index: -1; +} + .answerbox--question-media, .question-media, .question-body { overflow: visible !important; } diff --git a/app/views/question/show.html.haml b/app/views/question/show.html.haml index 67ad0eb3..1bb30c6e 100644 --- a/app/views/question/show.html.haml +++ b/app/views/question/show.html.haml @@ -1,35 +1,6 @@ - provide(:title, "#{@question.user.display_name.blank? ? "@#{@question.user.screen_name}'s" : "#{@question.user.display_name}'s"} question | #{APP_CONFIG['site_name']}") -.panel.panel-question - .container - .panel-body - .media.question-media - - unless @question.author_is_anonymous - %a.pull-left{href: show_user_profile_path(@question.user.screen_name)} - %img.img-rounded.answerbox--img{src: gravatar_url(@question.user)} - .media-body.question-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 - %ul.dropdown-menu.dropdown-menu-right{role: :menu} - - if current_user.mod? or @question.user == current_user - %li.text-danger - %a{href: '#', data: { action: 'ab-question-destroy', q_id: @question.id, redirect: if @question.author_is_anonymous? then "/" else show_user_questions_path(@question.user.screen_name) end }} - %i.fa.fa-trash-o - Delete Question - - unless @question.user == current_user - %li - %a{href: '#', data: { action: 'ab-question-report', q_id: @question.id }} - %i.fa.fa-exclamation-triangle - Report - %h6.text-muted.media-heading.answerbox--question-user - = user_screen_name @question.user, @question.author_is_anonymous - asked - %span{title: @question.created_at, data: { toggle: :tooltip, placement: :bottom }} - = time_ago_in_words(@question.created_at) - ago - %p.answerbox--question-text= @question.content += render 'shared/question_header', question: @question, hidden: false += render 'shared/question_header', question: @question, hidden: true .container.question-page / TODO: make this pretty (it's currently C-c'd straight from shared/_answerbox) diff --git a/app/views/shared/_question_header.haml b/app/views/shared/_question_header.haml new file mode 100644 index 00000000..0ead95b4 --- /dev/null +++ b/app/views/shared/_question_header.haml @@ -0,0 +1,33 @@ +.panel.panel-question{class: if hidden then 'question-hidden' end, tabindex: if hidden then '-1' end, aria: { hidden: if hidden then :true end }} + .container + .panel-body + .media.question-media + - unless question.author_is_anonymous + %a.pull-left{href: unless hidden then show_user_profile_path(question.user.screen_name) end} + %img.img-rounded.answerbox--img{src: gravatar_url(question.user)} + .media-body.question-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 + %ul.dropdown-menu.dropdown-menu-right{role: :menu} + - if current_user.mod? or question.user == current_user + %li.text-danger + %a{href: '#', data: { action: 'ab-question-destroy', q_id: question.id, redirect: if question.author_is_anonymous? then "/" else show_user_questions_path(question.user.screen_name) end }} + %i.fa.fa-trash-o + Delete Question + - unless question.user == current_user + %li + %a{href: '#', data: { action: 'ab-question-report', q_id: question.id }} + %i.fa.fa-exclamation-triangle + Report + %h6.text-muted.media-heading.answerbox--question-user + = user_screen_name question.user, question.author_is_anonymous, !hidden + - unless hidden + asked + %span{title: question.created_at, data: { toggle: :tooltip, placement: :bottom }} + = time_ago_in_words(question.created_at) + ago + %p.answerbox--question-text= question.content