Page MenuHomeGRNET

No OneTemporary

File Metadata

Created
Sat, Mar 21, 2:17 PM
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 @@
<tr>
<td><%= link_to "##{faq.id}", admin_faq_path(faq) %></td>
<td><%= faq.priority %></td>
<td><%= link_to faq.title, admin_faq_path(faq) %></td>
- <td><%= faq.body %></td>
+ <td><%= faq.pretty_body.html_safe %></td>
<td><%= I18n.l(faq.created_at, format: :short) %></td>
<td><%= I18n.l(faq.updated_at, format: :short) rescue '-' %></td>
<td>
<%= link_to admin_faq_path(faq) do %>
<label class="glyphicon glyphicon-eye-open text-primary" alt="show"></label>
<% end %>
<%= link_to edit_admin_faq_path(faq) do %>
<label class="glyphicon glyphicon-edit text-primary" alt="show"></label>
<% end %>
<%= link_to admin_faq_path(faq), method: :delete,
data: { confirm: 'The FAQ entry is going to be destroyed' } do %>
<label class="glyphicon glyphicon-remove text-danger" alt="show"></label>
<% end %>
</td>
</tr>
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 @@
<div class="col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">
<h4><%= @faq.title %></h4>
</div>
<br/>
<p>
- <%= @faq.body %>
+ <%= @faq.pretty_body %>
</p>
</div>
<%= link_to 'Back to FAQ', admin_faqs_path %>
<%= link_to edit_admin_faq_path(@faq), class: 'btn btn-default' do %>
<label class="glyphicon glyphicon-edit text-primary"></label>
Edit
<% end %>
<%= link_to admin_faq_path(@faq), method: :delete,
data: { confirm: 'FAQ entry will be deleted' }, class: 'btn btn-default right' do %>
<label class="glyphicon glyphicon-remove text-danger"></label>
Delete
<% end %>
</div>
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 %>
<tr>
- <td><%= faq.title %></td>
- <td><%= faq.body %></td>
+ <td>
+ <h2>
+ <a href="#<%= faq.title %>" class='faq-link'>
+ <svg aria-hidden='true' height='16' role='img' version='1.1' viewBox='0 0 16 16' width='16'>
+ <path d='M4 9h1v1h-1c-1.5 0-3-1.69-3-3.5s1.55-3.5 3-3.5h4c1.45 0 3 1.69 3 3.5 0 1.41-0.91 2.72-2 3.25v-1.16c0.58-0.45 1-1.27 1-2.09 0-1.28-1.02-2.5-2-2.5H4c-0.98 0-2 1.22-2 2.5s1 2.5 2 2.5z m9-3h-1v1h1c1 0 2 1.22 2 2.5s-1.02 2.5-2 2.5H9c-0.98 0-2-1.22-2-2.5 0-0.83 0.42-1.64 1-2.09v-1.16c-1.09 0.53-2 1.84-2 3.25 0 1.81 1.55 3.5 3 3.5h4c1.45 0 3-1.69 3-3.5s-1.5-3.5-3-3.5z'>
+ </path>
+ </svg>
+ </a>
+ <%= faq.title %>
+ </h2>
+ <%= faq.pretty_body %>
+ </td>
</tr>
<% 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 @@
<h3>Frequently Asked Questions</h3>
<h4>...and some useful tips</h4>
<div class="table-responsive">
<table class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th class="col-xs-3">Title</th>
- <th class="col-xs-8">Body</th>
- </tr>
- </thead>
-
<tbody>
<%= render partial: 'faq', collection: @faqs %>
</tbody>
</table>
</div>

Event Timeline