mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 01:14:56 +08:00
21 lines
408 B
Ruby
21 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
|