mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:19:52 +01:00
Add question markup renderer
This commit is contained in:
parent
09172a56ef
commit
67ee589b5b
4 changed files with 13 additions and 3 deletions
10
app/services/question_markdown.rb
Normal file
10
app/services/question_markdown.rb
Normal file
|
@ -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) }
|
||||
= pluralize(a.question.answer_count, t('views.general.answer'))
|
||||
.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) }
|
||||
= 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)
|
||||
.pull-right
|
||||
.btn-group
|
||||
|
|
|
@ -30,4 +30,4 @@
|
|||
= user_screen_name question.user, anonymous: question.author_is_anonymous, url: false
|
||||
- else
|
||||
= 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 a new issue