Class: BitCore::ContentProviders::SlideshowProvider
Overview
Defines presentation logic for a Slideshow.
Instance Method Summary
collapse
#data_class, #pretty_label
Instance Method Details
#add_or_update_slideshow(title, arm_id = nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 32
def add_or_update_slideshow(title, arm_id = nil)
if source_content
source_content.update(title: title)
else
slideshow = BitCore::Slideshow.create(arm_id: arm_id, title: title)
update(source_content: slideshow)
end
source_content
end
|
#exists?(position) ⇒ Boolean
24
25
26
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 24
def exists?(position)
slideshow.slides.exists?(position: position)
end
|
#render_current(options) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 10
def render_current(options)
options.view_context.render(
template: "slides/show",
locals: {
slide: slide(options.position)
}
)
end
|
#show_nav_link? ⇒ Boolean
28
29
30
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 28
def show_nav_link?
true
end
|
#slide(position) ⇒ Object
19
20
21
22
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 19
def slide(position)
slideshow.slides.find_by(position: position) ||
BitCore::Slide.new(body: "no slides")
end
|
#slideshow ⇒ Object
6
7
8
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 6
def slideshow
source_content || Slideshow.new
end
|