Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Modify profile admin UI for is_suspicious (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Nov 6, 2012
1 parent 81949ed commit 009d4ed
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions www/%participant_id/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -394,28 +394,29 @@
);
});

{% if user.ADMIN and participant['balanced_account_uri'] %}
// Wire up payin suspender.
// ========================
{% if user.ADMIN %}
// Wire up is_suspicious toggle.
// =============================

$('#payin-suspender').click(function()
$('.is-suspicious-knob').click(function()
{
jQuery.ajax(
{ url: 'toggle-payin-suspension.json'
{ url: 'toggle-is-suspicious.json'
, type: 'POST'
, dataType: 'json'
, success: function(data)
{
if (data.is_suspicious)
$('#balanced-account').addClass('is-suspicious');
$("#accounts").addClass('is-suspicious');
else
$('#balanced-account').removeClass('is-suspicious');
var val = data.is_suspicious ? 'Uns' : 'S';
$('#payin-suspender').text(val + 'uspend Payins');
$("#accounts").removeClass('is-suspicious');
$('INPUT.is-suspicious-knob').attr( 'checked'
, data.is_suspicious
);
}
, error: function() {
alert( "Failed to toggle payin suspension. "
+ "Please try again."
alert( "Failed to change is_suspicious. Please "
+ "try again."
);
}
}
Expand Down Expand Up @@ -689,8 +690,16 @@ <h3>Linked Accounts</h3>

{% end %}

{% if user.ADMIN %}
<p>
<input name="is_suspicious" class="is-suspicious-knob" type="checkbox"
{% if participant['is_suspicious'] %}checked="true"{% end %} />
<label for="is_suspicious" class="is-suspicious-knob">Suspicious</label>
</p>
{% end %}


<ul id="accounts">
<ul id="accounts"{% if participant['is_suspicious'] %} class="is-suspicious"{% end %}>
{% for account in accounts %}
<li>
{% if account['network'] == 'github' %}
Expand All @@ -709,11 +718,8 @@ <h3>Linked Accounts</h3>
</li>
{% end %}
{% if user.ADMIN and participant['balanced_account_uri'] %}
<li id="balanced-account"{% if participant['is_suspicious'] %} class="is-suspicious"{% end %}>
<img src="/assets/balanced-avatar.png" />
Balanced Payments
<button id="payin-suspender" class="small">{{ 'Unsuspend' if participant['is_suspicious'] else 'Suspend' }} Payins</button>
<br />
<li id="balanced-account">
<img src="/assets/balanced-avatar.png" /> Balanced Payments<br />
<a href="https://www.balancedpayments.com/{{ participant['balanced_account_uri'][3:] }}">balancedpayments.com/...</a>
</li>
{% end %}
Expand Down

0 comments on commit 009d4ed

Please sign in to comment.