rewards: got everything loading

v1.18.x
psychobunny 10 years ago
parent b1c37775c5
commit 4145046e02

@ -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;

@ -6,7 +6,7 @@
<form>
<ul>
<!-- BEGIN active -->
<li>
<li data-rewardID="{active.rewardID}">
<div class="well inline-block">
<label for="condition">If User's</label><br />
<select name="condition" data-selected="{active.condition}">

Loading…
Cancel
Save