From ec25d5f6faaea7ecf85961ab8fa4fc2c0e6041a2 Mon Sep 17 00:00:00 2001 From: Ana Date: Sat, 5 Dec 2015 16:10:19 +0100 Subject: [PATCH 1/3] how it works page moved tolocale files using markdown --- Gemfile | 2 +- Gemfile.lock | 2 ++ app/helpers/application_helper.rb | 44 +++++++++++++++++++++++++++ app/views/pages/how_it_works.html.erb | 41 +++---------------------- config/locales/pages.en.yml | 40 ++++++++++++++++++++++++ config/locales/pages.es.yml | 41 +++++++++++++++++++++++++ 6 files changed, 133 insertions(+), 37 deletions(-) diff --git a/Gemfile b/Gemfile index 1b2e4f906..d6fa8aa3e 100644 --- a/Gemfile +++ b/Gemfile @@ -56,7 +56,7 @@ gem 'groupdate' # group temporary data gem 'browser' gem 'turnout' - +gem 'redcarpet' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' diff --git a/Gemfile.lock b/Gemfile.lock index e3088b30d..001e73c4b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -311,6 +311,7 @@ GEM thor (>= 0.18.1, < 2.0) raindrops (0.15.0) rake (10.4.2) + redcarpet (3.3.3) referer-parser (0.3.0) request_store (1.2.1) responders (2.1.0) @@ -474,6 +475,7 @@ DEPENDENCIES poltergeist quiet_assets rails (= 4.2.5) + redcarpet responders rinku rollbar (~> 2.6.1) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 87d9ecc82..01be567d5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -21,4 +21,48 @@ module ApplicationHelper url_for(request.query_parameters.merge(query_parameters)) end + def markdown(text) + render_options = { + # will remove from the output HTML tags inputted by user + filter_html: false, + # will insert
tags in paragraphs where are newlines + # (ignored by default) + hard_wrap: true, + # hash for extra link options, for example 'nofollow' + link_attributes: { } + # more + # will remove tags from output + # no_images: true + # will remove tags from output + # no_links: true + # will remove