Sha256: 90c7b2563d815a4a66b6e0cdaa376f3f9f2e86137e722f5cfcb84c2de27fb839

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

var HashiVMware = function() {
  var selectedProduct = "";

  var $buyButton = $('#buy-fusion');
  var $products = $('#buy-now input[name=product]');

  function setSelectedProduct() {
    selectedProduct = $("input[name=product]:checked").val();
  }

  $products.unbind().on('change', function() {
    setSelectedProduct();

    var text = selectedProduct.charAt(0).toUpperCase() + selectedProduct.slice(1);
  });

  $buyButton.unbind().on('click', function(e) {
    e.preventDefault();

    var seats = parseInt($("#seats").val(), 10);
    if (isNaN(seats)) {
      alert("The number of seats you want to purchase must be a number.");
      return;
    } else if (seats <= 0) {
      alert("The number of seats you want must be greater than zero.");
      return;
    }

    var productId = "";
    if (selectedProduct == "fusion") {
      productId = "279661674";
    } else if (selectedProduct == "workstation") {
      productId = "302167489";
    } else {
      alert("Unknown product selected. Please refresh and try again.");
      return;
    }

    window.location = "http://shopify.hashicorp.com/cart/" + productId + ":" + seats;
  });

  if ($buyButton.length > 0) {
    setSelectedProduct();
  }
}

$(document).on('ready turbolinks:load', HashiVMware)

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/website/source/assets/javascripts/_vmware.js
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/website/source/assets/javascripts/_vmware.js
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/website/source/assets/javascripts/_vmware.js
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/website/source/assets/javascripts/_vmware.js