Sha256: 6964a3c89900581834ba1d6ab5b76362184eb40244488e034168fe4ffb78cbcf

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

# StaticTemplate is for when you just want to hard-code the embed code
# into the /templates directory. This is either to avoid an expensive
# call to an oEmbed endpoint, or if there simply isn't another way to
# programatically retrieve the embed code.
#
# Your StaticTemplate adapter SHOULD define:
# * @Template      - The name of the template to use (in the templates
#                    directory)
# * @QueryDefaults - The default query paramters if no others are passed in.
#
# Your StaticTemplate adapter MAY define:
# * @Matchers - An array of regular expressions which will be used to extract
#               important information from the URL (such as an ID).
#               If your adapter doesn't need a Matcher, then you don't have to
#               define this property. This property is used by _parseUrl(),
#               which doesn't get called automatically.
#
class Embeditor.Adapters.StaticTemplate extends Embeditor.Adapter
    className: "StaticTemplate"

    # The template to use.
    @Template = null

    # Query parameter defaults
    @QueryDefaults = {}

    # The matchers to extract the info out of the URL.
    @Matchers = []


    swap: ->
        # Extract the info and render the template
        return


    _parseUrl: ->
        match = null

        _.find @adapter.Matchers, (m) =>
            match = m.exec(@href)

        match

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
embeditor-rails-2.2.0 app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-2.0.1 app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-2.0.0 app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-2.0.0.beta app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-1.1.1 app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-1.1.0 app/assets/javascripts/embeditor/adapters/static_template.js.coffee
embeditor-rails-1.0.1 app/assets/javascripts/embeditor/adapters/static_template.js.coffee