mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
20 lines
408 B
Ruby
20 lines
408 B
Ruby
module UserNotificationsHelper
|
|
|
|
def indent(text, by=2)
|
|
spacer = " " * by
|
|
result = ""
|
|
text.each_line do |line|
|
|
result << spacer << line
|
|
end
|
|
result
|
|
end
|
|
|
|
def correct_top_margin(html, desired)
|
|
fragment = Nokogiri::HTML.fragment(html)
|
|
if para = fragment.css("p:first").first
|
|
para["style"] = "margin-top: #{desired};"
|
|
end
|
|
fragment.to_html.html_safe
|
|
end
|
|
|
|
end
|