From f1fa18bfa557a197cd5472aeb8bf27b8ae924bf8 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 16 Feb 2019 14:30:54 -0300 Subject: [PATCH] poder usar markdown en las etiquetas de las plantillas --- app/helpers/application_helper.rb | 4 ++++ app/views/posts/_form.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 287ca14..40fcf4f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -18,4 +18,8 @@ module ApplicationHelper "#{f.first}[#{f.last}]" end + + def sanitize_markdown(text, options = {}) + sanitize(CommonMarker.render_html(text), options) + end end diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 70dcb5b..5757999 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -126,7 +126,7 @@ = fa_icon 'link', title: t('posts.anchor') - if template.private? = fa_icon 'lock', title: t('posts.private') - = template.label + = sanitize_markdown template.label, tags: %w[a] - if template.help %small.text-muted.form-text= template.help = render "posts/template_field/#{type}", template: template, name: template.key, value: value