Module: EveApp::EntityHelper

Defined in:
app/helpers/eve_app/entity_helper.rb

Instance Method Summary collapse

Instance Method Details

#entity(record, size: :medium, description: nil, link_url: nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/eve_app/entity_helper.rb', line 2

def entity(record, size: :medium, description: nil, link_url: nil)
  title = link_url ? link_to(record.name, link_url) : record.name
  body = [
    (:h6, title.html_safe),
    (:div, description || record.try(:description), class: 'text-sm text-muted')
  ].join("\n").html_safe
  wrapper = [
    image_tag(record.image),
    (:div, body, class: "media-body")
  ].join("\n").html_safe

  raw (:div, wrapper, class: "media media-entity #{size}")
end