diff --git a/public/src/admin/extend/rewards.js b/public/src/admin/extend/rewards.js index 02725f49fb..712089d401 100644 --- a/public/src/admin/extend/rewards.js +++ b/public/src/admin/extend/rewards.js @@ -40,7 +40,8 @@ define('admin/extend/rewards', function() { } function selectReward(el) { - var div = el.parents('li').find('.inputs'), + var parent = el.parents('[data-rewardID]'), + div = parent.find('.inputs'), inputs, html = ''; @@ -48,6 +49,7 @@ define('admin/extend/rewards', function() { if (available.hasOwnProperty(reward)) { if (parseInt(available[reward].rewardID, 10) === parseInt(el.attr('data-selected'), 10)) { inputs = available[reward].inputs; + parent.attr('data-rewardID', available[reward].rewardID); break; } } @@ -74,6 +76,17 @@ define('admin/extend/rewards', function() { }); div.html(html); + + $('[data-rewardID]').each(function(i) { + var div = $(this).find('.inputs'), + rewards = active[i].rewards; + + for (var reward in rewards) { + if (rewards.hasOwnProperty(reward)) { + div.find('[name="' + reward + '"]').val(rewards[reward]); + } + } + }); } return rewards; diff --git a/src/views/admin/extend/rewards.tpl b/src/views/admin/extend/rewards.tpl index a45f319847..d2deab96d1 100644 --- a/src/views/admin/extend/rewards.tpl +++ b/src/views/admin/extend/rewards.tpl @@ -6,7 +6,7 @@