Refreshing your API key on your profile now uses a ajax request.

This commit is contained in:
2010-10-29 12:44:57 +01:00
parent d66f3b4a9f
commit 75ce3c8943
3 changed files with 16 additions and 3 deletions

BIN
media/img/spinner.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@@ -107,7 +107,6 @@ def eveapi_refresh(request, userid=0):
import_eve_account(acc.api_key, acc.api_user_id, force_cache=True)
request.user.get_profile().update_access()
print request.GET
if request.is_ajax():
acc = EVEAccount.objects.get(id=userid)
return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript')

View File

@@ -6,6 +6,19 @@
{% block content %}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.js"></script>
<script type="text/javascript">
function refresh_apikey(key) {
$("#api-time-" + key).html("<center><img src='/static/img/spinner.gif'/></center>");
$.getJSON("/profile/refresh/eveapi/" + key + "/", function(json) {
$("#api-time-" + json[0].fields.api_user_id).html("a moment ago");
});
}
</script>
<h1>Your Profile</h1>
<p>
@@ -72,8 +85,9 @@ setup.</p>
<td>{{ acc.description }}</td>
<td>{{ acc.get_api_keytype_display }}</td>
<td>{{ acc.get_api_status_display }}</td>
<td>{{ acc.api_last_updated|naturaltimediff }}</td>
<td><a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,&nbsp;
<td id="api-time-{{ acc.api_user_id }}">{{ acc.api_last_updated|naturaltimediff }}</td>
<td><a href="javascript:refresh_apikey({{ acc.api_user_id }})">Refresh (AJAX)</a>,&nbsp;
<a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,&nbsp;
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,&nbsp;
<a href="{% url sso.views.eveapi_del acc.api_user_id %}">Delete</a></td>
</tr>