Class: Plotline::EntryPresenter
Instance Method Summary
collapse
#initialize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Plotline::BasePresenter
Instance Method Details
#body_markdown ⇒ Object
5
6
7
8
|
# File 'app/presenters/plotline/entry_presenter.rb', line 5
def body_markdown
text = parse_custom_markdown(@object.body.to_s)
RDiscount.new(text, :smart, :footnotes).to_html.html_safe
end
|
#image_attrs(img) ⇒ Object
31
32
33
34
35
|
# File 'app/presenters/plotline/entry_presenter.rb', line 31
def image_attrs(img)
return { data: {} } unless img
{ data: { width: img.width, height: img.height, ratio: img.ratio } }
end
|
#photoset_item(src:, alt:, attrs:) ⇒ Object
10
11
12
13
14
15
|
# File 'app/presenters/plotline/entry_presenter.rb', line 10
def photoset_item(src:, alt:, attrs:)
img = images_hash[src]
attrs["class"] = "photoset-item " + attrs["class"].to_s
photoset_item_html(img, src, alt, attrs, image_attrs(img))
end
|
#photoset_item_html(img, src, alt, attrs, image_attrs) ⇒ Object
17
18
19
20
21
22
|
# File 'app/presenters/plotline/entry_presenter.rb', line 17
def photoset_item_html(img, src, alt, attrs, image_attrs)
content_tag(:figure, attrs) do
concat image_tag(src, { alt: alt }.merge(image_attrs))
concat content_tag(:figcaption, alt)
end
end
|
#single_image_html(src:, alt:, attrs:) ⇒ Object
24
25
26
27
28
29
|
# File 'app/presenters/plotline/entry_presenter.rb', line 24
def single_image_html(src:, alt:, attrs:)
content_tag(:figure, attrs) do
concat image_tag(src, alt: alt)
concat content_tag(:figcaption, alt)
end
end
|