Sha256: c3d09bf789e1d28e924537b0480b7ee69ca33d2f1fa1e7a32034c51596f62f0d

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

module BitPlayer
  class ContentProviders::SlideshowProvider < ContentProvider
    def slideshow
      source_content
    end

    def render_current(options)
      options.view_context.render(
        template: 'slides/show',
        locals: {
          slide: slide(options.position)
        }
      )
    end

    def slide(position)
      slideshow.slides.where(position: position).first || BitPlayer::Slide.new(body: 'no slides')
    end

    def exists?(position)
      slideshow.slides.exists?(position: position)
    end

    def show_nav_link?
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_player-0.1.0 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.0.5 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.0.4 app/models/bit_player/content_providers/slideshow_provider.rb