making rows function shared
This commit is contained in:
parent
a452bd5d8d
commit
b0c2d46c48
@ -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?
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user