Module: Peoplefinder::ApplicationHelper

Defined in:
app/helpers/peoplefinder/application_helper.rb

Constant Summary collapse

FLASH_NOTICE_KEYS =
%w[ error notice warning ]

Instance Method Summary collapse

Instance Method Details



18
19
20
21
# File 'app/helpers/peoplefinder/application_helper.rb', line 18

def breadcrumbs(items)
  render partial: 'peoplefinder/shared/breadcrumbs',
         locals: { items: items }
end

#flash_messagesObject



25
26
27
28
29
30
31
32
33
# File 'app/helpers/peoplefinder/application_helper.rb', line 25

def flash_messages
  messages = flash.keys.map(&:to_s) & FLASH_NOTICE_KEYS
  return if messages.empty?
  (:div, class: 'inner-block') {
    (:div, id: 'flash-messages') {
      messages.map { |type| flash_message(type) }.join.html_safe
    }
  }
end

#govspeak(source) ⇒ Object



12
13
14
15
16
# File 'app/helpers/peoplefinder/application_helper.rb', line 12

def govspeak(source)
  options = { header_offset: 2 }
  doc = Govspeak::Document.new(source, options)
  doc.to_html.html_safe
end

#info_text(key) ⇒ Object



35
36
37
# File 'app/helpers/peoplefinder/application_helper.rb', line 35

def info_text(key)
  t(key, scope: %w[peoplefinder views info_text].join('.')).html_safe
end

#last_updateObject



3
4
5
6
7
8
9
10
# File 'app/helpers/peoplefinder/application_helper.rb', line 3

def last_update
  current_object = @person || @group
  if current_object && current_object.updated_at.present?
    "Last updated: #{
      current_object.updated_at.strftime('%d %b %Y %H:%M')
    }."
  end
end