diff --git a/public/src/admin/extend/rewards.js b/public/src/admin/extend/rewards.js index d93741d76b..595eb6678a 100644 --- a/public/src/admin/extend/rewards.js +++ b/public/src/admin/extend/rewards.js @@ -41,10 +41,10 @@ define('admin/extend/rewards', function() { }) .on('click', '.toggle', function() { var btn = $(this), - disabled = btn.html() === 'Enable', + disabled = btn.hasClass('btn-success'), id = $(this).parents('[data-id]').attr('data-id'); - btn.toggleClass('btn-warning').toggleClass('btn-success').html(disabled ? 'Enable' : 'Disable'); + btn.toggleClass('btn-warning').toggleClass('btn-success').html(disabled ? 'Disable' : 'Enable'); // send disable api call return false; }); @@ -165,7 +165,7 @@ define('admin/extend/rewards', function() { }); data.id = $(this).attr('data-id'); - data.disabled = $(this).find('.toggle').html() === 'Enable'; + data.disabled = $(this).find('.toggle').hasClass('btn-success'); activeRewards.push(data); }); diff --git a/src/rewards/admin.js b/src/rewards/admin.js index fac78bfeec..722cac1ee5 100644 --- a/src/rewards/admin.js +++ b/src/rewards/admin.js @@ -115,6 +115,7 @@ function getActiveRewards(callback) { } }, function(err, data) { if (data.main) { + data.main.disabled = data.main.disabled === 'true'; data.main.rewards = data.rewards; activeRewards.push(data.main); }