display_all

This commit is contained in:
nilsding 2014-12-12 18:54:17 +01:00
parent 130cbb27ce
commit 54ec828e5b
2 changed files with 12 additions and 7 deletions

View file

@ -1,5 +1,6 @@
class AnswerController < ApplicationController class AnswerController < ApplicationController
def show def show
@answer = Answer.find(params[:id]) @answer = Answer.find(params[:id])
@display_all = true
end end
end end

View file

@ -20,13 +20,17 @@
%p.answerbox--question-text %p.answerbox--question-text
= a.question.content = a.question.content
.panel-body .panel-body
%p= a.content[0..255] %p
- if a.content.length > 255 - if @display_all.nil?
[...] = a.content[0..255]
%br/ - if a.content.length > 255
Answer too long to display. [...]
%a{href: show_user_answer_path(a.user.screen_name, a.id)} %br/
Read the entire answer Answer too long to display.
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
Read the entire answer
- else
= a.content
- if @user.nil? - if @user.nil?
.row .row
.col-md-6.col-sm-4.col-xs-7.text-left.text-muted .col-md-6.col-sm-4.col-xs-7.text-left.text-muted