Sha256: dd6ae76cbe7f190106db5ee8391fb8868abc928c4afc20d0623b10a28e78efd0
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 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) -> @$el.load url, => @delegateEvents() @_init() @show() render : () -> @renderFromUrl @model.get('editurl') _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 'editurl', $(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
6 entries across 6 versions & 1 rubygems