Skip to content

Commit

Permalink
release 2.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Heckmann committed Nov 15, 2013
1 parent 7b26b96 commit e69fd7b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 20 deletions.
42 changes: 31 additions & 11 deletions build/recurly.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Recurly.js - v2.2.7
// Recurly.js - v2.2.8
//
// Communicates with Recurly <https://recurly.com> via a JSONP API,
// generates UI, handles user error, and passes control to the client
Expand Down Expand Up @@ -50,7 +50,7 @@ R.settings = {
, oneErrorPerField: true
};

R.version = '2.2.7';
R.version = '2.2.8';

R.dom = {};

Expand Down Expand Up @@ -1256,7 +1256,7 @@ function initCommonForm($form, options) {
$li.find('input').focus();
});

$form.delegate('input', 'change keyup', function() {
$form.delegate('input', 'change keyup init', function() {
var $input = $(this);
var $li = $(this).parent();

Expand All @@ -1268,7 +1268,6 @@ function initCommonForm($form, options) {
}
});


$form.delegate('input', 'focus', function() {
$(this).parent().addClass('focus');
});
Expand Down Expand Up @@ -1997,7 +1996,7 @@ R.buildSubscriptionForm = function(options) {
'<div class="name">'+addOn.name+'</div>' +
'<div class="field quantity">' +
'<div class="placeholder">Qty</div>' +
'<input type="text">' +
'<input type="text" value="1">' +
'</div>' +
'<div class="cost"/>' +
'</div>');
Expand All @@ -2009,22 +2008,36 @@ R.buildSubscriptionForm = function(options) {
}

// Quantity Change
$addOnsList.delegate('.quantity input', 'change keyup', function(e) {
var $addOn = $(this).closest('.add_on');
$addOnsList.delegate('.quantity input', 'change keyup recalculate', function(e) {
var $qty = $(this);
var $addOn = $qty.closest('.add_on');
var addOn = $addOn.data('add_on');
var newQty = parseInt($(this).val(),10) || 1;
subscription.findAddOnByCode(addOn.code).quantity = newQty;
var newQty = $qty.val() === '' ? 1 : parseInt($qty.val(), 10);

subscription.findAddOnByCode(addOn.code).quantity = newQty > 0 ? newQty : 0;
updateTotals();
});

$addOnsList.delegate('.quantity input', 'blur', function(e) {
var $qty = $(this);
var $addOn = $qty.closest('.add_on');
var newQty = parseInt($qty.val(), 10);
if (newQty < 1) {
$qty.trigger('recalculate');
}
if (newQty === 0) {
$addOn.trigger('actuate');
}
});

$addOnsList.bind('selectstart', function(e) {
if($(e.target).is('.add_on')) {
e.preventDefault();
}
});

// Add-on click
$addOnsList.delegate('.add_on', 'click', function(e) {
$addOnsList.delegate('.add_on', 'click actuate', function(e) {
if($(e.target).closest('.quantity').length) return;

var selected = !$(this).hasClass('selected');
Expand All @@ -2036,7 +2049,12 @@ R.buildSubscriptionForm = function(options) {
// add
var sa = subscription.redeemAddOn(addOn);
var $qty = $(this).find('.quantity input');
sa.quantity = parseInt($qty.val(),10) || 1;
var qty = parseInt($qty.val(), 10);
if (qty < 1 || isNaN(qty)) {
qty = 1;
$qty.val(qty);
}
sa.quantity = qty;
$qty.focus();
}
else {
Expand All @@ -2046,6 +2064,8 @@ R.buildSubscriptionForm = function(options) {

updateTotals();
});

$addOnsList.find('input').trigger('init');
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion build/recurly.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#Change Log

##Version 2.2.8 (Nov 15, 2013)

- fixed; removing an addon with a negative quantity and re-adding it resets the quantity to 1 #92
- fixed; setting addon quantity to a negative value contributes 0 to the total #92
- fixed; setting addon quantity to 0 removes it #92
- fixed; addons have a default quantity of "1" if quantity is allowed #91
- docs; fix release notes format
- docs; added release documentation
- docs; updated for contributors and employees
- make; add `make release`

##Version 2.2.7 (Oct 18, 2013)

- Sort states by display name #88 [drewish](https://github.com/drewish)
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "recurly-js"
, "version": "2.2.7"
, "dependencies": {
"stylus": "0.19.x"
, "jade": "0.17.x"
, "async": "0.1.x"
"name": "recurly-js",
"version": "2.2.8",
"dependencies": {
"stylus": "0.19.x",
"jade": "0.17.x",
"async": "0.1.x"
}
}
}
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.7
2.2.8

0 comments on commit e69fd7b

Please sign in to comment.