Class: BitCore::ContentProviders::SlideshowProvider

Inherits:
BitCore::ContentProvider show all
Defined in:
app/models/bit_core/content_providers/slideshow_provider.rb

Overview

Defines presentation logic for a Slideshow.

Instance Method Summary collapse

Methods inherited from BitCore::ContentProvider

#data_class

Instance Method Details

#exists?(position) ⇒ Boolean

Returns:

  • (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

Returns:

  • (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

#slideshowObject



5
6
7
# File 'app/models/bit_core/content_providers/slideshow_provider.rb', line 5

def slideshow
  source_content
end