pass in expected format of active rewards

v1.18.x
psychobunny 10 years ago
parent cd26f5d06d
commit 67b693cd3a

@ -135,11 +135,20 @@ define('admin/extend/rewards', function() {
var activeRewards = [];
$('#active li').each(function() {
var data = $(this).find('form.main').serializeArray();
var data = {rewards: {}},
main = $(this).find('form.main').serializeArray(),
rewards = $(this).find('form.rewards').serializeArray();
main.forEach(function(obj) {
data[obj.name] = obj.value;
});
rewards.forEach(function(obj) {
data.rewards[obj.name] = obj.value;
});
data.rewards = $(this).find('form.rewards').serializeArray();
data.disabled = $(this).find('.toggle').html() === 'Enable';
activeRewards.push(data);
});

@ -2,7 +2,8 @@
var rewards = {},
async = require('async'),
plugins = require('../plugins');
plugins = require('../plugins'),
db = require('../database');
var defaults = {
conditionals: [
@ -29,6 +30,9 @@ var defaults = {
]
};
rewards.save = function(data, callback) {
};
rewards.get = function(callback) {
async.parallel({

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

Loading…
Cancel
Save