Sha256: 6be858f87a6e848fe34510fb9e9aa16b073b90f8e6159a0a644572cce3453494

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

class Lalala::Markdown::Handlers::Vimeo < Lalala::Markdown::Handlers::Base

  def initialize(options={})
    options.assert_valid_keys(:color, :height, :show_badge, :show_byline, :show_portrait, :show_title, :width)

    options = {
      color: "ffffff",
      height: 315,
      show_badge: 0,
      show_byline: 0,
      show_portrait: 0,
      show_title: 0,
      width:  560
    }.merge(options)

    @options = options
  end

  def image(url, alt=nil, title=nil)
    unless %r|^vimeo[:]//(.+)$| === url
      return ""
    end

    id = $1

    helpers.content_tag :span, class: "embed-container is-vimeo" do
      helpers.content_tag(
        :iframe,
        "",
        width:           @options[:width],
        height:          @options[:height],
        src:             "//player.vimeo.com/video/#{id}?portrait=#{@options[:show_portrait]}&title=#{@options[:show_title]}&badge=#{@options[:show_badge]}&byline=#{@options[:show_byline]}&color=#{@options[:color]}&wmode=transparent",

        frameborder:     0,
        allowfullscreen: true
      )
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.425 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.420 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.419 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.418 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.417 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.0.0.dev.416 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.415 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.414 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.413 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.412 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.411 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.410 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.409 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.0.0.dev.407 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.408 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.398 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.397 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.0.0.dev.396 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.0.0.dev.395 lib/lalala/markdown/handlers/vimeo.rb
lalala-4.1.0.dev.394 lib/lalala/markdown/handlers/vimeo.rb