Skip to content

Commit

Permalink
Merge pull request #42 from wp-media/1.6.1
Browse files Browse the repository at this point in the history
1.6.1
  • Loading branch information
remyperona authored Nov 22, 2016
2 parents 1859ca7 + 20a7b4f commit bd2df34
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 30 deletions.
14 changes: 10 additions & 4 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,26 @@ jQuery(function($){

// Do the ONETIMES Markup
$.each( onetimes, function( index, value ) {
var $tpl = $( ot_clone ).clone();
var $tpl = $( ot_clone ).clone(),
$offer = $( '.imagify-pre-checkout-offers' ).find( '.imagify-offer-onetime' );

// parent classes
classes = '';
if ( ( ot_user_cons < value.quota && ot_suggested === false ) ) {
classes = ' imagify-offer-selected';
ot_suggested = true;

// add this offer as pre-selected item in pre-checkout view
var $offer = $( '.imagify-pre-checkout-offers' ).find( '.imagify-offer-onetime' );

// populate the Pre-checkout view depending on user_cons
imagify_populate_offer( $offer, value, 'onetime' );
}

// if too big, populate with the biggest offer available
// TODO: create custom offers at this point
if ( index === onetimes.length-1 && ot_suggested === false ) {
// populate the Pre-checkout view depending on user_cons
var tvalue = onetimes[ onetimes.length - 1 ];
imagify_populate_offer( $offer, tvalue, 'onetime' );
}

// populate each offer
$tpl = imagify_populate_offer( $tpl, value, 'onetime', classes );
Expand Down
Loading

0 comments on commit bd2df34

Please sign in to comment.