ditching rewardID in favour of verbose id's

v1.18.x
psychobunny 10 years ago
parent 46e0fad2d8
commit 91c02d4e29

@ -63,16 +63,16 @@ define('admin/extend/rewards', function() {
}
function selectReward(el) {
var parent = el.parents('[data-rewardID]'),
var parent = el.parents('[data-id]'),
div = parent.find('.inputs'),
inputs,
html = '';
for (var reward in available) {
if (available.hasOwnProperty(reward)) {
if (parseInt(available[reward].rewardID, 10) === parseInt(el.attr('data-selected'), 10)) {
if (available[reward].id === el.attr('data-selected')) {
inputs = available[reward].inputs;
parent.attr('data-rewardID', available[reward].rewardID);
parent.attr('data-id', available[reward].id);
break;
}
}
@ -104,7 +104,7 @@ define('admin/extend/rewards', function() {
}
function populateInputs() {
$('[data-rewardID]').each(function(i) {
$('[data-id]').each(function(i) {
var div = $(this).find('.inputs'),
rewards = active[i].rewards;
@ -121,7 +121,7 @@ define('admin/extend/rewards', function() {
li = $('#active li').last().clone(true);
li.attr('data-index', parseInt(li.attr('data-index') + 1, 10))
.attr('data-rewardID', '');
.attr('data-id', '');
li.find('.inputs').html('');
li.find('[name="reward"]').val('');

@ -55,7 +55,7 @@ rewards.get = function(callback) {
rewards: function(next) {
plugins.fireHook('filter:rewards.rewards', [
{
"rewardID": 0,
"id": "core:add-to-group",
"name": "Add to Group",
"inputs": [
{
@ -80,7 +80,7 @@ rewards.get = function(callback) {
]
},
{
"rewardID": 1,
"id": "core:alert-user",
"name": "Send alert message",
"inputs": [
{
@ -107,7 +107,7 @@ function getConditions() {
function getActiveRewards(callback) {
callback(false, [
{
"rewardID": 1,
"id": "core:alert-user",
"condition": "postcount",
"conditional": "greaterthan",
"rewards": {
@ -118,7 +118,7 @@ function getActiveRewards(callback) {
"disabled": false
},
{
"rewardID": 0,
"id": "core:add-to-group",
"condition": "lastLoggedIn",
"conditional": "lesserthan",
"rewards": {

@ -6,7 +6,7 @@
<form>
<ul id="active">
<!-- BEGIN active -->
<li data-rewardID="{active.rewardID}" data-index="@index">
<li data-id="{active.id}" data-index="@index">
<div class="well inline-block">
<label for="condition">If User's</label><br />
<select name="condition" data-selected="{active.condition}">
@ -26,9 +26,9 @@
</div>
<div class="well inline-block">
<label for="condition">Then:</label><br />
<select name="reward" data-selected="{active.rewardID}">
<select name="reward" data-selected="{active.id}">
<!-- BEGIN rewards -->
<option value="{rewards.rewardID}">{rewards.name}</option>
<option value="{rewards.id}">{rewards.name}</option>
<!-- END rewards -->
</select>
</div>

Loading…
Cancel
Save