Module: SolveMedia::ViewHelpers

Defined in:
lib/solvemedia/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#solvemedia_puzzle(options = {}) ⇒ String

View helper to insert the Solve Media puzzle HTML.

Can be set to use either the standard version or the AJAX version. For more complex uses of the AJAX version, such as multi-puzzle, you should not use this method and instead use purpose-written Javascript in your view.

Calls SolveMedia.puzzle internally.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :tabindex (Integer) — default: nil

    HTML tabindex

  • :theme (String) — default: 'purple'
  • :lang (String) — default: 'en'
  • :size (String) — default: '300x150'

    Widget size. Please note that 300x150 is the only size which can display ads.

  • :use_SSL (Boolean) — default: false

    Set to true if using the puzzle on an HTTPS site

  • :ajax (Boolean) — default: false

    Uses the AJAX api (see above)

  • :ajax_div (String)

    ID of the div element into which the puzzle is inserted, if using AJAX. Required if ajax is set to true.

Returns:

  • (String)

    HTML for the puzzle, marked as html_safe.

Raises:

  • (AdCopyError)

    if key is not set

  • (AdCopyError)

    if AJAX puzzle is selected but no container div is specified

See Also:



25
26
27
# File 'lib/solvemedia/view_helpers.rb', line 25

def solvemedia_puzzle(options={})
  return SolveMedia.puzzle(CKEY, options).html_safe
end