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) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 31
def add_or_update_slideshow(title)
if source_content
source_content.update(title: title)
else
slideshow = BitCore::Slideshow.create(title: title)
update(source_content: slideshow)
end
source_content
end
|
#exists?(position) ⇒ Boolean
23
24
25
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 23
def exists?(position)
slideshow.slides.exists?(position: position)
end
|
#render_current(options) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 9
def render_current(options)
options.view_context.render(
template: "slides/show",
locals: {
slide: slide(options.position)
}
)
end
|
#show_nav_link? ⇒ Boolean
27
28
29
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 27
def show_nav_link?
true
end
|
#slide(position) ⇒ Object
18
19
20
21
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 18
def slide(position)
slideshow.slides.where(position: position).first ||
BitCore::Slide.new(body: "no slides")
end
|
#slideshow ⇒ Object
5
6
7
|
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 5
def slideshow
source_content
end
|