Add question markup renderer
This commit is contained in:
parent
09172a56ef
commit
67ee589b5b
|
@ -0,0 +1,10 @@
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
|
class QuestionMarkdown < Redcarpet::Render::Base
|
||||||
|
include Rails.application.routes.url_helpers
|
||||||
|
include SharedMarkers
|
||||||
|
|
||||||
|
def paragraph(text)
|
||||||
|
"<p>#{text}</p>"
|
||||||
|
end
|
||||||
|
end
|
|
@ -29,4 +29,4 @@
|
||||||
%a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) }
|
%a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) }
|
||||||
= pluralize(a.question.answer_count, t('views.general.answer'))
|
= pluralize(a.question.answer_count, t('views.general.answer'))
|
||||||
.answerbox__question-text
|
.answerbox__question-text
|
||||||
= a.question.content
|
= question_markdown a.question.content
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
·
|
·
|
||||||
%a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) }
|
%a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) }
|
||||||
= pluralize(i.question.answer_count, t('views.inbox.entry.response'))
|
= pluralize(i.question.answer_count, t('views.inbox.entry.response'))
|
||||||
%p.answerbox__question-text= i.question.content
|
%p.answerbox__question-text= question_markdown i.question.content
|
||||||
- if i.question.user_id != current_user.id || current_user.has_role?(:administrator)
|
- if i.question.user_id != current_user.id || current_user.has_role?(:administrator)
|
||||||
.pull-right
|
.pull-right
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
|
@ -30,4 +30,4 @@
|
||||||
= user_screen_name question.user, anonymous: question.author_is_anonymous, url: false
|
= user_screen_name question.user, anonymous: question.author_is_anonymous, url: false
|
||||||
- else
|
- else
|
||||||
= raw t('views.answerbox.asked', user: user_screen_name(question.user, anonymous: question.author_is_anonymous), time: time_tooltip(question))
|
= raw t('views.answerbox.asked', user: user_screen_name(question.user, anonymous: question.author_is_anonymous), time: time_tooltip(question))
|
||||||
%p.answerbox__question-text= question.content
|
%p.answerbox__question-text= question_markdown question.content
|
||||||
|
|
Loading…
Reference in New Issue