Add markdown at post description
This commit is contained in:
@ -122,4 +122,8 @@ class Post < ActiveRecord::Base
|
||||
def member
|
||||
@member ||= Member.find_by(user_id: user_id, organization_id: organization_id)
|
||||
end
|
||||
|
||||
def rendered_description
|
||||
RDiscount.new(description, :autolink)
|
||||
end
|
||||
end
|
||||
|
||||
@ -44,8 +44,8 @@
|
||||
—
|
||||
= ph
|
||||
|
||||
.col-md-9
|
||||
%p.lead.post-description= post.description
|
||||
.col-md-9.lead
|
||||
= post.rendered_description.to_html.html_safe
|
||||
|
||||
- unless current_user
|
||||
.alert.alert-info
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
.form-group
|
||||
= f.label :description
|
||||
= f.text_area :description, rows: "10", class: "form-control"
|
||||
%p.small.text-right
|
||||
= t ".you_can_use"
|
||||
- wiki_url = "https://#{I18n.locale}.wikipedia.org/wiki/Markdown"
|
||||
%a{ href: wiki_url, title: "Markdown" } Markdown
|
||||
.form-group
|
||||
= f.label :category, required: true
|
||||
= f.select :category_id, Category.all.sort_by{ |a| a.name.downcase }.map{ |cat| [cat.name, cat.id] }, { include_blank: true }, { class: "form-control" }
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
%h4
|
||||
= link_to post do
|
||||
= post.title
|
||||
%p= post.description
|
||||
%p= strip_tags(post.rendered_description.to_html)
|
||||
%p
|
||||
%small
|
||||
- if post.category
|
||||
|
||||
@ -372,3 +372,5 @@ ca:
|
||||
movements:
|
||||
delete_reason: Esteu segur d'esborrar aquest comentari?
|
||||
movements: Moviments
|
||||
post_form:
|
||||
you_can_use: Pots fer servir
|
||||
|
||||
@ -368,3 +368,5 @@ en:
|
||||
movements:
|
||||
delete_reason: Are you sure to delete this comment?
|
||||
movements: Movements
|
||||
post_form:
|
||||
you_can_use: You can use
|
||||
|
||||
@ -377,3 +377,5 @@ es:
|
||||
movements:
|
||||
delete_reason: ¿Está seguro de borrar este comentario?
|
||||
movements: Movimientos
|
||||
post_form:
|
||||
you_can_use: Puedes usar
|
||||
|
||||
Reference in New Issue
Block a user