Sha256: d01979fe4f0d6f9f4bd501e21098cba54178549e0819f5e62cb212bec4458284

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# This doesn't inherit from Adapters.Oembed because the Embedly plugin
# handles most of that stuff on its own.
class Embeditor.Adapters.Embedly extends Embeditor.Adapter
    className: "Embedly"

    # This object should hold any keys that we want to
    # send to the API. Any key not in this object will
    # be ignored as a data attribute.
    @QueryDefaults =
        maxheight   : 450

    @PluginDefaults =
        method      : "after"
        className   : Embeditor.DefaultOptions.wrapperClass
        endpoint    : 'oembed'
        # Key must be specified


    constructor: (@element, @options={}) ->
        pluginOpts = options['Embedly']?['plugin'] or {}
        @pluginOptions = _.defaults(pluginOpts, Embedly.PluginDefaults)

        super


    swap: ->
        params = @_buildEmbedlyParams()
        @element.embedly(params)


    _buildEmbedlyParams: ->
        if @embedlyParams
            return @embedlyParams

        @embedlyParams = _.extend(
            @pluginOptions,
            query : @queryParams)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embeditor-rails-1.0.1 app/assets/javascripts/embeditor/adapters/embedly.js.coffee
embeditor-rails-0.1.0 app/assets/javascripts/embeditor/adapters/embedly.js.coffee