Module: EmbedHelper

Defined in:
app/helpers/embed_helper.rb

Instance Method Summary collapse

Instance Method Details

#embed_post_date(dt) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/embed_helper.rb', line 4

def (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
      dt.strftime("%b '%y")
    end
  end
end

#get_html(post) ⇒ Object



18
19
20
21
22
23
# File 'app/helpers/embed_helper.rb', line 18

def get_html(post)
  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)
end