Sha256: 7fbf925351e04dc55a55936ce58a9c07b071deab9d6e799d123b43637b909159
Contents?: true
Size: 985 Bytes
Versions: 21
Compression:
Stored size: 985 Bytes
Contents
PaymentRowView = Backbone.View.extend events: "click .js-edit": "onEdit" "click .js-save": "onSave" "click .js-cancel": "onCancel" "click .js-display-amount": "onEdit" onEdit: (e) -> e.preventDefault() @$el.addClass("editing") onCancel: (e) -> e.preventDefault() @$el.removeClass("editing") onSave: (e) -> e.preventDefault() amount = @$(".js-edit-amount").val() options = success: (model, response, options) => @$(".js-display-amount").text(model.attributes.display_amount) @$el.removeClass("editing") error: (model, response, options) => show_flash 'error', response.responseJSON.error @model.save({ amount: amount }, options) $ -> order_id = $('#payments').data('order-id') Payment = Backbone.Model.extend urlRoot: Spree.routes.payments_api(order_id) $('tr.payment').each -> model = new Payment({id: $(@).data('payment-id')}) new PaymentRowView({el: @, model: model})
Version data entries
21 entries across 21 versions & 1 rubygems