Delete Confirmation modal example - PeppeL-G/bootstrap-3-modal GitHub Wiki

Clicking the delete button opens the modal

  'click .__deleteLineItem': function(e, t) {
Modal.show('cartViewDeleteConfirmModal', {
  product: this,
  productName: this.productName,
});
},

modal looks like this

<template name="cartViewDeleteConfirmModal">
  <div class="modal fade">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-body">
            {{mf 'cartViewDeleteConfirmModal.delete' 'Remove Item'}}:<br/>
          <p class="text-danger">"{{this.productName}}"</p>
            {{mf 'cartViewDeleteConfirmModal.areYouSure' 'Are you sure?'}}
        </div>
        <div class="modal-footer">
              <button class="__cancel btn btn-default">No</button>
              <button class="__delete btn btn-danger">Yes</button>
            </div>
      </div>
    </div>
  </div>
</template>

confirm click actually does the delete

Template.cartViewDeleteConfirmModal.events({
  'click .__cancel': function(e, t) {
    Modal.hide();
  },

  'click .__delete': function(e, t) {
    var self = this;
    Meteor.call('cart.removeLineItem', {
      cartId: self.product.parent._id,
      lineItemId: self.product._id,
    }, function(err){
      Modal.hide();
      if(!err){
        toastr.success('Item removed.', 'Success');
        analytics.track('Deleted a cart line item');
      } else {
        toastr.error(err.message, 'Error removing item');
      }
    });
  },
});
⚠️ **GitHub.com Fallback** ⚠️