2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-03-20 13:25:17 -04:00
|
|
|
module EmbedHelper
|
|
|
|
|
|
|
|
def embed_post_date(dt)
|
|
|
|
current = Time.now
|
|
|
|
|
|
|
|
if dt >= 1.day.ago
|
|
|
|
distance_of_time_in_words(dt, current)
|
|
|
|
else
|
|
|
|
if dt.year == current.year
|
|
|
|
dt.strftime("%e %b")
|
|
|
|
else
|
2014-03-23 15:22:02 -04:00
|
|
|
dt.strftime("%b '%y")
|
2014-03-20 13:25:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-09 13:24:44 -04:00
|
|
|
def get_html(post)
|
2020-03-26 08:07:41 -04:00
|
|
|
key = "js.action_codes.#{post.action_code}"
|
|
|
|
cooked = post.cooked.blank? ? I18n.t(key, when: nil).humanize : post.cooked
|
|
|
|
|
|
|
|
raw PrettyText.format_for_email(cooked, post)
|
2015-05-01 09:04:45 -04:00
|
|
|
end
|
2014-03-20 13:25:17 -04:00
|
|
|
end
|