Sha256: e10078caa3ced84d26c4dbbb1b7f2de31b78abdfe6af364dcbd9e4437b848749

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

module BitPlayer
  module ContentProviders
    # Defines presentation logic for a Slideshow.
    class 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 ||
          Slide.new(body: "no slides")
      end

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

      def show_nav_link?
        true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bit_player-0.3.0 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.2.5 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.2.3 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.2.2 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.2.1 app/models/bit_player/content_providers/slideshow_provider.rb
bit_player-0.2.0 app/models/bit_player/content_providers/slideshow_provider.rb