loading mock data

v1.18.x
psychobunny 10 years ago
parent 0e7c3be9d3
commit 2bebac964e

@ -0,0 +1,21 @@
"use strict";
/* global define, app, socket, bootbox */
define('admin/extend/rewards', function() {
var rewards = {};
var available,
active;
rewards.init = function() {
available = JSON.parse($('#rewards').val());
active = JSON.parse($('#active').val());
$('[data-selected]').each(function() {
$(this).val($(this).attr('data-selected'));
});
};
return rewards;
});

@ -30,11 +30,11 @@ rewards.get = function(callback) {
},
{
"name": "<",
"conditional": "smallerthan"
"conditional": "lesserthan"
},
{
"name": "<=",
"conditional": "smallerorequalthan"
"conditional": "lesserorequalthan"
},
{
"name": "is string:",
@ -44,18 +44,16 @@ rewards.get = function(callback) {
active: [
{
"rewardID": 0,
"conditional": {
"condition": ">",
"value": 100
},
"condition": "postcount",
"conditional": "greaterthan",
"value": 100,
"disabled": 0
},
{
"rewardID": 1,
"conditional": {
"condition": ">",
"value": 100
},
"rewardID": 0,
"condition": "lastLoggedIn",
"conditional": "lesserthan",
"value": 10,
"disabled": 0
}
],

@ -8,22 +8,30 @@
<!-- BEGIN active -->
<li>
If User's
<select name="condition" class="form-control">
<select name="condition">
<!-- BEGIN conditions -->
<option value="{conditions.condition}">{conditions.name}</option>
<option value="{conditions.condition}" data-selected="{active.condition}">{conditions.name}</option>
<!-- END conditions -->
</select>
Is
<select name="conditional" class="form-control">
<select name="conditional" data-selected="{active.conditional}">
<!-- BEGIN conditionals -->
<option value="{conditionals.conditional}">{conditionals.name}</option>
<!-- END conditionals -->
</select>
<input type="text" class="form-control" value="{active.conditional.value}" />
<input type="text" value="{active.value}" />
Then
<select name="reward" data-selected="{active.rewardID}">
<!-- BEGIN rewards -->
<option value="{rewards.rewardID}">{rewards.name}</option>
<!-- END rewards -->
</select>
</li>
<!-- END active -->
</ul>
</form>
<input type="hidden" id="rewards" value="{function.stringify, rewards}" />
<input type="hidden" id="active" value="{function.stringify, active}" />
</div>
</div>
</div>

Loading…
Cancel
Save