From 14792c14f32e3374cb82a4457161eb5907283643 Mon Sep 17 00:00:00 2001 From: Godwin Date: Sun, 13 Jul 2014 13:15:05 -0600 Subject: [PATCH] Added some filtering to make descriptions more consistent --- app/assets/stylesheets/sass/_layout.scss | 4 ++-- app/helpers/application_helper.rb | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index 5e493a4..d12de70 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -303,7 +303,7 @@ main { #banner { position: relative; background-size: cover; - background-position: center 66.6667%; + background-position: 25% 66.6667%; //padding-top: 4em; color: $white; overflow: visible; @@ -457,7 +457,7 @@ main { figure { img { - max-height: 100%; + max-height: 75%; } } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e0beb14..9384062 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,4 @@ + module ApplicationHelper @@keyQueue = nil @@translationsOnThisPage = nil @@ -363,7 +364,23 @@ module ApplicationHelper end def p(object, attribute) - ('

' + object.send(attribute.to_s).strip.gsub(/\s*\n+\s*/, '

') + '

').html_safe + content = object.send(attribute.to_s) + result = '' + if content =~ /<(p|span|h\d|div)[^>]*>/ + result = content.gsub(/\s*(style|class|id|width|height|font)=\".*?\"/, '') + .gsub(/ /, ' ') + .gsub(/<(\/)?\s*h\d\s*>/, '<\1h3>') + .gsub(/

(.*?)\s*()+/, '

\1

') + .gsub(/]*>\s*(.*?)\s*<\/span>/, '\1') + .gsub(/

\s*<\/p>/, '') + .gsub(/<(\/)?div>/, '<\1p>') + if !(result =~ /]*>/) + result = '

' + result + '

' + end + else + result = '

' + content.strip.gsub(/\s*\n+\s*/, '

') + '

' + end + result.html_safe end def form_field(f, response = nil)