Added some filtering to make descriptions more consistent
This commit is contained in:
parent
44a6bce08c
commit
14792c14f3
@ -303,7 +303,7 @@ main {
|
|||||||
#banner {
|
#banner {
|
||||||
position: relative;
|
position: relative;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center 66.6667%;
|
background-position: 25% 66.6667%;
|
||||||
//padding-top: 4em;
|
//padding-top: 4em;
|
||||||
color: $white;
|
color: $white;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
@ -457,7 +457,7 @@ main {
|
|||||||
|
|
||||||
figure {
|
figure {
|
||||||
img {
|
img {
|
||||||
max-height: 100%;
|
max-height: 75%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
@@keyQueue = nil
|
@@keyQueue = nil
|
||||||
@@translationsOnThisPage = nil
|
@@translationsOnThisPage = nil
|
||||||
@ -363,7 +364,23 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def p(object, attribute)
|
def p(object, attribute)
|
||||||
('<p>' + object.send(attribute.to_s).strip.gsub(/\s*\n+\s*/, '</p><p>') + '</p>').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(/<p>(.*?)<br\s\/?>\s*(<br\s\/?>)+/, '<p>\1</p><p>')
|
||||||
|
.gsub(/<span[^>]*>\s*(.*?)\s*<\/span>/, '\1')
|
||||||
|
.gsub(/<p>\s*<\/p>/, '')
|
||||||
|
.gsub(/<(\/)?div>/, '<\1p>')
|
||||||
|
if !(result =~ /<p[^>]*>/)
|
||||||
|
result = '<p>' + result + '</p>'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result = '<p>' + content.strip.gsub(/\s*\n+\s*/, '</p><p>') + '</p>'
|
||||||
|
end
|
||||||
|
result.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def form_field(f, response = nil)
|
def form_field(f, response = nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user