Sha256: 62ff05d5ca14bf48dcc28b929786e9042ccb0fd4c83dca0ae14f969051d212a6

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

module BitCore
  module ContentProviders
    # Defines presentation logic for a Slideshow.
    class SlideshowProvider < BitCore::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 ||
          BitCore::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

5 entries across 5 versions & 1 rubygems

Version Path
bit_core-1.1.6 app/models/bit_core/content_providers/slideshow_provider.rb
bit_core-1.1.5 app/models/bit_core/content_providers/slideshow_provider.rb
bit_core-1.1.4 app/models/bit_core/content_providers/slideshow_provider.rb
bit_core-1.1.3 app/models/bit_core/content_providers/slideshow_provider.rb
bit_core-1.1.2 app/models/bit_core/content_providers/slideshow_provider.rb