Sha256: 4d70979b9b7faaa9099abcf421b3dbd4aaa88f846cb20521c7ec397c08e80a04
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
class @FormPopup.View extends Backbone.View className : 'add_new_popup soft-hide' events : 'click' : 'onClick' 'click .cancel-btn' : 'onReset' onReset : (e) -> e.preventDefault() @closePopup() onClick : (e) -> @closePopup() if $(e.target).closest('.simple_form').length is 0 show : () => @$el.show() @_updatePosition() hide : () -> @$el.hide() closePopup : () -> @trigger 'close' @undelegateEvents() @$el.remove() renderFromUrl : (url) -> $.get url, (html) => @$el.html html @_updatePosition() @delegateEvents() @_init() render : () -> @renderFromUrl @model.get('edit_url') _init : () -> $form = @$el.find 'form' if $form.length > 0 $(document).trigger('init-plugins') @_initForm $form else @_bindButton() _initForm : ($form) -> Form.init $form $form.on 'ajax-submit-done', (e, response) => @model.update response.data @closePopup() _bindButton : () -> @$el.find('button').click (e) => @model.set 'edit_url', $(e.currentTarget).data('new') @render() _updatePosition : () -> @$el.css top : "#{window.pageYOffset}px" @init : (model) -> popupView = new FormPopup.View model : model popupView.render() popupView
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.1.1 | app/assets/javascripts/rademade_admin/app/form-popup/view.coffee |