making rows function shared

This commit is contained in:
Torsten 2023-01-22 20:49:55 +02:00
parent a452bd5d8d
commit b0c2d46c48
2 changed files with 10 additions and 10 deletions

View File

@ -8,16 +8,6 @@ module Merged
render( template , section: section)
end
def rows( text )
return 5 if text.blank?
text = text.text unless text.is_a?(String)
return 5 if text.blank?
rows = (text.length / 50).to_i
rows += text.count("\n")
return 5 if rows < 5
rows
end
# background image as inline style
def bg(section , clazz = "")
return {class: clazz} if section.image.blank?

View File

@ -30,5 +30,15 @@ module Merged
self.renderer.render(text).html_safe
end
def rows( text )
return 5 if text.blank?
text = text.text unless text.is_a?(String)
return 5 if text.blank?
rows = (text.length / 50).to_i
rows += text.count("\n")
return 5 if rows < 5
rows
end
end
end