Sha256: a4d40c452343344d6dace80dfcaa3b8889ef2bc36ecd41066c1bea58d9169a19
Contents?: true
Size: 646 Bytes
Versions: 6
Compression:
Stored size: 646 Bytes
Contents
Spree.Views.Cart.EmptyCartButton = Backbone.View.extend({ initialize: function() { this.listenTo(this.collection, 'update', this.render); this.render(); }, events: { "click": "onClick" }, onClick: function(e) { e.preventDefault() if (!confirm(Spree.translations.are_you_sure_delete)) { return; } this.model.empty({ success: () => { this.collection.reset() this.collection.push({}) } }) }, render: function() { var isNew = function (item) { return item.isNew() }; this.$el.prop("disabled", !this.collection.length || this.collection.some(isNew)); } });
Version data entries
6 entries across 6 versions & 1 rubygems