diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 31a0c81..806f34f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,78 +1,86 @@ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require bootstrap.min *= require jstree-default *= require bootstrap-chosen *= require dataTables.bootstrap.min *= require_tree . *= require_self */ /* Make sure navbar does not overlay body */ body { padding-top: 70px; } .right { text-align: right; margin-right: 0px; float: right; } .graybox { max-width: 500px; margin-right: 0; margin-left: 0; background-color: #F7F7F9; margin-bottom: 30px; } .graybox form { padding-top: 30px; } #_days_back { margin: auto 10px; } tr.fatal > td { background-color: #EA7272; } tr.fatal > td { background-color: #EA7272; } li.logo { } li.logo > a { padding-left: 60px; background: url('/images/logo.png') no-repeat scroll 4px 5px; padding-top: 5px; padding-bottom: 5px; } li.logo > a > p { font-size: 13px; margin-bottom: 0; color: #333333px; } .jstree-closed > a > i.jstree-checkbox, .jstree-open > a > i.jstree-checkbox { display: none; } .datatable-wrapper { margin-bottom: 20px; } + +.faq-link > svg { + visibility: hidden; +} + +h2:hover > a.faq-link > svg { + visibility: visible; +} diff --git a/app/models/faq.rb b/app/models/faq.rb index 04b0402..0e100d6 100644 --- a/app/models/faq.rb +++ b/app/models/faq.rb @@ -1,7 +1,13 @@ # Faq entries are short instructions for using Archiving. class Faq < ActiveRecord::Base establish_connection ARCHIVING_CONF validates :title, :body, presence: true + # Runs the markdown and returns the html output + # + # @return [String] HTML output of body + def pretty_body + Archiving.markdown.render(body).html_safe + end end diff --git a/app/views/admin/faqs/_faq.html.erb b/app/views/admin/faqs/_faq.html.erb index 4f4b081..65ec986 100644 --- a/app/views/admin/faqs/_faq.html.erb +++ b/app/views/admin/faqs/_faq.html.erb @@ -1,20 +1,20 @@ <%= link_to "##{faq.id}", admin_faq_path(faq) %> <%= faq.priority %> <%= link_to faq.title, admin_faq_path(faq) %> - <%= faq.body %> + <%= faq.pretty_body.html_safe %> <%= I18n.l(faq.created_at, format: :short) %> <%= I18n.l(faq.updated_at, format: :short) rescue '-' %> <%= link_to admin_faq_path(faq) do %> <% end %> <%= link_to edit_admin_faq_path(faq) do %> <% end %> <%= link_to admin_faq_path(faq), method: :delete, data: { confirm: 'The FAQ entry is going to be destroyed' } do %> <% end %> diff --git a/app/views/admin/faqs/show.html.erb b/app/views/admin/faqs/show.html.erb index fcc6474..e237ea0 100644 --- a/app/views/admin/faqs/show.html.erb +++ b/app/views/admin/faqs/show.html.erb @@ -1,26 +1,26 @@

<%= @faq.title %>


- <%= @faq.body %> + <%= @faq.pretty_body %>

<%= link_to 'Back to FAQ', admin_faqs_path %> <%= link_to edit_admin_faq_path(@faq), class: 'btn btn-default' do %> Edit <% end %> <%= link_to admin_faq_path(@faq), method: :delete, data: { confirm: 'FAQ entry will be deleted' }, class: 'btn btn-default right' do %> Delete <% end %>
diff --git a/app/views/application/_faq.html.erb b/app/views/application/_faq.html.erb index 9b0d470..a0c7e55 100644 --- a/app/views/application/_faq.html.erb +++ b/app/views/application/_faq.html.erb @@ -1,6 +1,16 @@ -<%= cache(['faq', 'v1', faq], expires_in: 1.day) do %> +<%= cache(['faq', 'v2', faq], expires_in: 1.day) do %> - <%= faq.title %> - <%= faq.body %> + +

+ + + + <%= faq.title %> +

+ <%= faq.pretty_body %> + <% end %> diff --git a/app/views/application/faq.html.erb b/app/views/application/faq.html.erb index 401010b..ec895de 100644 --- a/app/views/application/faq.html.erb +++ b/app/views/application/faq.html.erb @@ -1,17 +1,10 @@

Frequently Asked Questions

...and some useful tips

- - - - - - - <%= render partial: 'faq', collection: @faqs %>
TitleBody