Sha256: d91e737be5ee639e90e6e337bb076d56ae391f15e012f1290aee58c8f42cd9ea

Contents?: true

Size: 718 Bytes

Versions: 10

Compression:

Stored size: 718 Bytes

Contents

class @Widget

  constructor: (element) ->
    @element = $(element)
    @widget = @element.find('.widget-show')
    @widgetForm = @element.find('.widget-form')
    @editLink = @element.find('.js-edit')
    @cancelLink = @element.find('.js-close')
    @setBindings()

  setBindings: () =>
    @editLink.bind('click', @showForm)
    @cancelLink.bind('click', @hideForm)

  showForm: (event) =>
    event.preventDefault()
    @widget.addClass('hide')
    @widgetForm.removeClass('hide')

  hideForm: (event) =>
    event.preventDefault()
    @widgetForm.addClass('hide')
    @widget.removeClass('hide')


$.fn.widget = () ->
  @each ->
    new Widget($(this))

jQuery ->
  $(".js-widget").each () ->
    $(this).widget()

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
georgia-0.8.0 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.8 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.7 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.6 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.5 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.4 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.3 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.2 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.1 app/assets/javascripts/georgia/components/widget.js.coffee
georgia-0.7.0 app/assets/javascripts/georgia/components/widget.js.coffee