Sha256: db33da82ea24c167fefc6127aced1378f265cc9466f875c421e4db0e966a2c7f

Contents?: true

Size: 445 Bytes

Versions: 4

Compression:

Stored size: 445 Bytes

Contents

class Previewer
  constructor: (@el)->

  init: ->
    @el.on 'click', =>
      @update()
      false

  update: ->
    jQuery.ajax(
      type: @el.data('method'),
      url:  @el.attr('href'),
      data: {query: @source()},
      complete: (xhr)=>
        @result().html(xhr.responseText)
    )

  source: ->
    $(@el.data('source')).val()

  result: ->
    $(@el.data('result'))

Adhoq.enablePreview = ($el)->
  (new Previewer($el)).init()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adhoq-0.0.5 app/assets/javascripts/adhoq/previewer.js.coffee
adhoq-0.0.4 app/assets/javascripts/adhoq/previewer.js.coffee
adhoq-0.0.3 app/assets/javascripts/adhoq/previewer.js.coffee
adhoq-0.0.2 app/assets/javascripts/adhoq/previewer.js.coffee