Add backend for tips and enable markdown support

This commit is contained in:
Sebastian Serth
2020-10-08 19:04:10 +02:00
parent dce5998a2a
commit e550828c58
16 changed files with 171 additions and 10 deletions

View File

@@ -0,0 +1,17 @@
- content_for :head do
// Force a full page reload, see https://github.com/turbolinks/turbolinks/issues/326.
Otherwise, code might not be highlighted correctly (race condition)
meta name='turbolinks-visit-control' content='reload'
= javascript_pack_tag('highlight', 'data-turbolinks-track': true)
= stylesheet_pack_tag('highlight', media: 'all', 'data-turbolinks-track': true)
h1
= @tip.to_s
= render('shared/edit_button', object: @tip)
= row(label: 'tip.title', value: @tip.title)
= row(label: 'tip.description', value: render_markdown(@tip.description), class: 'm-0')
= row(label: 'file.file_type', value: @tip.file_type_id? ? \
link_to_if(policy(@tip.file_type).show?, @tip.file_type.name, @tip.file_type) : '')
= row(label: 'tip.example', value: @tip.file_type_id? ? \
code_tag(@tip.example, @tip.file_type.programming_language) : '')