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