change terms from txt to markdown

This commit is contained in:
Joshua Arts 2018-07-27 15:12:27 -04:00
parent 4b9ca3f13e
commit 2a2e4f285c
5 changed files with 21 additions and 2 deletions

View File

@ -63,6 +63,9 @@ gem 'http_accept_language'
# Use Capistrano for deployment # Use Capistrano for deployment
# gem 'capistrano-rails', group: :development # gem 'capistrano-rails', group: :development
# Markdown parsing.
gem 'redcarpet'
group :production do group :production do
# Use a postgres database in production. # Use a postgres database in production.
gem 'pg', '~> 0.18' gem 'pg', '~> 0.18'

View File

@ -189,6 +189,7 @@ GEM
rb-fsevent (0.10.3) rb-fsevent (0.10.3)
rb-inotify (0.9.10) rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2) ffi (>= 0.5.0, < 2)
redcarpet (3.4.0)
redis (3.3.5) redis (3.3.5)
ref (2.0.0) ref (2.0.0)
rspec-core (3.7.1) rspec-core (3.7.1)
@ -296,6 +297,7 @@ DEPENDENCIES
puma (~> 3.0) puma (~> 3.0)
rails (~> 5.0.7) rails (~> 5.0.7)
rails-controller-testing rails-controller-testing
redcarpet
redis (~> 3.0) redis (~> 3.0)
rspec-rails (~> 3.7) rspec-rails (~> 3.7)
rubocop rubocop

View File

@ -99,5 +99,4 @@ a {
.terms { .terms {
overflow: scroll; overflow: scroll;
height: 55vh; height: 55vh;
white-space: pre-line;
} }

View File

@ -25,7 +25,22 @@ module ApplicationHelper
Rails.configuration.allow_user_signup Rails.configuration.allow_user_signup
end end
# Determines if the BigBlueButton endpoint is the default.
def bigbluebutton_endpoint_default? def bigbluebutton_endpoint_default?
Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
end end
# Parses markdown for rendering.
def markdown(text)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
no_intra_emphasis: true,
fenced_code_blocks: true,
disable_indented_code_blocks: true,
autolink: true,
tables: true,
underline: true,
highlight: true)
markdown.render(text).html_safe
end
end end

View File

@ -6,7 +6,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="terms"> <div class="terms">
<p><%= Rails.configuration.terms %></p> <%= markdown(Rails.configuration.terms) %>
</div> </div>
<div class="btn-list text-right pt-8"> <div class="btn-list text-right pt-8">
<%= button_to t("terms.accept"), terms_path, params: {accept: true}, class: "btn btn-primary btn-space" %> <%= button_to t("terms.accept"), terms_path, params: {accept: true}, class: "btn btn-primary btn-space" %>