Top Level Namespace

Includes:
ThemesHelper

Defined Under Namespace

Modules: ThemesHelper, ThreddedCreateApp, Users

Instance Method Summary collapse

Methods included from ThemesHelper

#current_theme, #themes

Instance Method Details

#page_titleObject



3
4
5
6
# File 'lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb', line 3

def page_title
  safe_join [content_for(:page_title) || content_for(:thredded_page_title),
             t('brand.name')].compact, ' - '
end

#time_ago(datetime, default: '-') ⇒ String



11
12
13
14
15
16
17
18
19
20
# File 'lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb', line 11

def time_ago(datetime, default: '-')
  timeago_tag datetime,
              lang: I18n.locale.to_s.downcase,
              format: (lambda do |t, _opts|
                t.year == Time.current.year ? :short : :long
              end),
              nojs: true,
              date_only: false,
              default: default
end

#timeago_tag_content(time, time_options = {}) ⇒ Object

Override the default timeago_tag_content from rails-timeago



23
24
25
26
27
28
29
30
# File 'lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb', line 23

def timeago_tag_content(time, time_options = {})
  if time_options[:nojs] &&
     (time_options[:limit].nil? || time_options[:limit] < time)
    t 'common.time_ago', time: time_ago_in_words(time)
  else
    I18n.l time.to_date, format: time_options[:format]
  end
end