mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
eve_api templates updated, forms now more flexable and easier to manage
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load gargoyle_tags %}
|
||||
|
||||
{% block title %}Add EVE API Key{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h1>Add EVE API Key</h1>
|
||||
</div>
|
||||
|
||||
{% ifswitch eve-cak %}
|
||||
<p>Please fill in your API key details and a optional description. You can create a API key on the <a href="https://support.eveonline.com/api/Key/CreatePredefined/59638024/0/false">API support site</a></p>
|
||||
{% else %}
|
||||
<p>Please fill in your API key as provided on the <a href="http://eve-online.com/api">EVE Online API page</a> and a optional description.</p>
|
||||
{% endifswitch %}
|
||||
|
||||
<form action="{% url eve_api.views.eveapi_add %}" method="post">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<br />
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Add Key" />
|
||||
|
||||
<formset>
|
||||
|
||||
{% include "eve_api/formfield.html" with field=form.api_user_id %}
|
||||
{% include "eve_api/formfield.html" with field=form.api_key class="xxlarge"%}
|
||||
<!--{% include "eve_api/formfield.html" with field=form.description %}-->
|
||||
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Add API Key" class="btn primary"/>
|
||||
</formset>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,30 +4,36 @@
|
||||
{% load naturaltimediff %}
|
||||
|
||||
{% block content %}
|
||||
<div class="alliance_info">
|
||||
<h1>{{ alliance.name }}</h1>
|
||||
|
||||
<ul>
|
||||
<li><b>Member Count:</b> {{ alliance.member_count }}</li>
|
||||
<li><b>Executor Corporation:</b> <a href="{% url eveapi-corporation alliance.executor.id %}">{{ alliance.executor }}</a></li>
|
||||
<li><b>Alliance Leader:</b> {{ executor }}</li>
|
||||
</ul>
|
||||
|
||||
<h2>Corporations</h2>
|
||||
|
||||
<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
|
||||
<script >
|
||||
$(function() {
|
||||
$("table#corporations").tablesorter({ sortList: [[0,0]] });
|
||||
});
|
||||
</script>
|
||||
<table class="zebra-striped" id="corporations">
|
||||
<thead>
|
||||
<tr><th class="header">Name</td><th class="header">Members</th><th class="header">Average SP</th><th class="header">API Coverage</th><th class="header">Director Key?</th></tr>
|
||||
</thead>
|
||||
{% for corp in corporations %}
|
||||
<tr><td><a href="{% url eveapi-corporation corp.id %}">{{ corp }}</a></td><td>{{ corp.member_count }}</td><td>{{ corp.average_sp|intcomma }}</td><td>{{ corp.api_key_coverage|floatformat:2 }}%</td><td>{{ corp.director_api_keys.count }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<div class="page-header">
|
||||
<h1>{{ alliance.name }}</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li><b>Member Count:</b> {{ alliance.member_count }}</li>
|
||||
<li><b>Executor Corporation:</b> <a href="{% url eveapi-corporation alliance.executor.id %}">{{ alliance.executor }}</a></li>
|
||||
<li><b>Alliance Leader:</b> {{ executor }}</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2>Corporations</h2>
|
||||
|
||||
<table class="zebra-striped" id="corporations">
|
||||
<thead>
|
||||
<tr><th class="header">Name</td><th class="header">Members</th><th class="header">Average SP</th><th class="header">API Coverage</th><th class="header">Director Key?</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for corp in corporations %}
|
||||
<tr><td><a href="{% url eveapi-corporation corp.id %}">{{ corp }}</a></td><td>{{ corp.member_count }}</td><td>{{ corp.average_sp|intcomma }}</td><td>{{ corp.api_key_coverage|floatformat:2 }}%</td><td>{{ corp.director_api_keys.count }}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<script src="{{ STATIC_URL }}js/jquery.tablesorter.min.js"></script>
|
||||
<script >
|
||||
$(function() { $("table#corporations").tablesorter({ sortList: [[0,0]] }); });
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -9,64 +9,57 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<h2>Attributes</h2>
|
||||
<div class="span8">
|
||||
<h2>Attributes</h2>
|
||||
|
||||
<ul>
|
||||
<li><span class="stat">Race:</span> <span class="value">{{ character.get_race_display }}</span></li>
|
||||
{% if character.gender %}<li><span class="stat">Gender:</span> <span class="value">{{ character.get_gender_display }}</span></li>{% endif %}
|
||||
<li><span class="stat">Corporation:</span> <a href="{% url eveapi-corporation character.corporation.id %}">{{ character.corporation.name }}</a></span></li>
|
||||
{% if character.corporation.alliance %}<li><span class="stat">Alliance:</span> <span class="value"><a href="{% url eveapi-alliance character.corporation.alliance.id %}">{{ character.corporation.alliance.name }}</a><span></li>{% endif %}
|
||||
<li><span class="stat">Joined Corporation:</span> <span class="value">{{ character.corporation_date|date:"Y/m/d H:i:s" }}</span></li>
|
||||
<li><span class="stat">Security Status:</span> {{ character.security_status|floatformat:2 }}</span></li>
|
||||
<li><span class="stat">Director:</span> <span class="value">{{ character.director }}</span></li>
|
||||
{% if character.current_training %}
|
||||
<li><spam class="stat">Training:</span> <span class="Value">{{ character.current_training.skill.name}} to Level</span></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<ul>
|
||||
<li><span class="stat">Race:</span> <span class="value">{{ character.get_race_display }}</span></li>
|
||||
{% if character.gender %}<li><span class="stat">Gender:</span> <span class="value">{{ character.get_gender_display }}</span></li>{% endif %}
|
||||
<li><span class="stat">Corporation:</span> <a href="{% url eveapi-corporation character.corporation.id %}">{{ character.corporation.name }}</a></span></li>
|
||||
{% if character.corporation.alliance %}<li><span class="stat">Alliance:</span> <span class="value"><a href="{% url eveapi-alliance character.corporation.alliance.id %}">{{ character.corporation.alliance.name }}</a><span></li>{% endif %}
|
||||
<li><span class="stat">Joined Corporation:</span> <span class="value">{{ character.corporation_date|date:"Y/m/d H:i:s" }}</span></li>
|
||||
<li><span class="stat">Security Status:</span> {{ character.security_status|floatformat:2 }}</span></li>
|
||||
<li><span class="stat">Director:</span> <span class="value">{{ character.director }}</span> {% if character.director %}(<a href="https://support.eveonline.com/api/Key/CreatePredefined/1968409/{{ character.id }}/true">Create a corporation API key</a>){% endif %}</li>
|
||||
{% if character.current_training %}
|
||||
<li><spam class="stat">Training:</span> <span class="Value">{{ character.current_training.skill.name}} to Level</span></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% if character.attrib_intelligence %}
|
||||
<h2>Stats</h2>
|
||||
<table class="zebra-striped" id="stats">
|
||||
<tbody>
|
||||
<tr><td>Intelligence</td><td> {{ character.attrib_intelligence }}</td></tr>
|
||||
<tr><td>Memory</td><td>{{ character.attrib_memory }}</td></tr>
|
||||
<tr><td>Charisma</td><td>{{ character.attrib_charisma }}</td></tr>
|
||||
<tr><td>Perception</td><td>{{ character.attrib_perception }}</td></tr>
|
||||
<tr><td>Willpower</td><td>{{ character.attrib_willpower }}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if character.attrib_intelligence %}
|
||||
<h2>Stats</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Stat</th><th>Value</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Intelligence</td><td> {{ character.attrib_intelligence }}</td></tr>
|
||||
<tr><td>Memory</td><td>{{ character.attrib_memory }}</td></tr>
|
||||
<tr><td>Charisma</td><td>{{ character.attrib_charisma }}</td></tr>
|
||||
<tr><td>Perception</td><td>{{ character.attrib_perception }}</td></tr>
|
||||
<tr><td>Willpower</td><td>{{ character.attrib_willpower }}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="span5 offset3">
|
||||
<div class="row pull-right">
|
||||
<img src="https://image.eveonline.com/Character/{{ character.id }}_256.jpg" />
|
||||
</div>
|
||||
<div class="row pull-right">
|
||||
<div class="span5">
|
||||
{% if character.corporation.alliance %}
|
||||
<img src="https://image.eveonline.com/Alliance/{{ character.corporation.alliance.id }}_64.png" class="pull-right" title="{{ character.corporation.alliance }} ({{ character.corporation.alliance.ticker }})"/>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="span5 offset3">
|
||||
<div class="row pull-right">
|
||||
<img src="https://image.eveonline.com/Character/{{ character.id }}_256.jpg" />
|
||||
</div>
|
||||
<div class="row pull-right">
|
||||
<div class="span5">
|
||||
{% if character.corporation.alliance %}
|
||||
<img src="https://image.eveonline.com/Alliance/{{ character.corporation.alliance.id }}_64.png" class="pull-right" title="{{ character.corporation.alliance }} ({{ character.corporation.alliance.ticker }})"/>
|
||||
{% endif %}
|
||||
<img src="https://image.eveonline.com/Corporation/{{ character.corporation.id }}_64.png" class="pull-right" title="{{ character.corporation }} ({{ character.corporation.ticker }})"/>
|
||||
</div>
|
||||
</div>
|
||||
<img src="https://image.eveonline.com/Corporation/{{ character.corporation.id }}_64.png" class="pull-right" title="{{ character.corporation }} ({{ character.corporation.ticker }})"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% if skillTree %}
|
||||
<h2>Skills</h2>
|
||||
|
||||
<p>
|
||||
<a href=#" id="openAll" class="btn">Open All</a>
|
||||
<a href=#" id="collapseAll" class="btn">Collapse All</a>
|
||||
<a href=#" id="openAll" class="btn">Open All</a>
|
||||
<a href=#" id="collapseAll" class="btn">Collapse All</a>
|
||||
</p>
|
||||
|
||||
<table>
|
||||
@@ -88,38 +81,34 @@
|
||||
{% if employmenthistory.count %}
|
||||
<h2>Employment History</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Corporation</th><th>Join Date</th><th>Leave Date</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for hist in employmenthistory %}
|
||||
<tr><td><a href="{% url eveapi-corporation hist.corporation.id %}">{{ hist.corporation.name }}</a></td><td>{{ hist.start_date }}</td><td>{% if hist.end_date %}{{ hist.end_date }}{% endif %}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<table class="zebra-striped">
|
||||
<thead>
|
||||
<tr><th>Corporation</th><th>Join Date</th><th>Leave Date</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for hist in employmenthistory %}
|
||||
<tr><td><a href="{% url eveapi-corporation hist.corporation.id %}">{{ hist.corporation.name }}</a></td><td>{{ hist.start_date }}</td><td>{% if hist.end_date %}{{ hist.end_date }}{% endif %}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(".skill_heading")
|
||||
.css("cursor", "pointer")
|
||||
.attr("title", "Click to expand/collapse section")
|
||||
.click(function(){
|
||||
$('tr[parent$=' + $(this).attr('id') + ']').toggle();
|
||||
});
|
||||
$("#openAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".child").show();
|
||||
});
|
||||
$("#collapseAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".child").hide();
|
||||
});
|
||||
$('tr[parent]').hide();
|
||||
});
|
||||
$(function(){
|
||||
$(".skill_heading")
|
||||
.css("cursor", "pointer")
|
||||
.attr("title", "Click to expand/collapse section")
|
||||
.click(function(){ $('tr[parent$=' + $(this).attr('id') + ']').toggle(); });
|
||||
$("#openAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".child").show();
|
||||
});
|
||||
$("#collapseAll").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".child").hide();
|
||||
});
|
||||
$('tr[parent]').hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
{% load humanize %}
|
||||
{% block content %}
|
||||
|
||||
<script src="/static/js/jquery.tablesorter.min.js"></script>
|
||||
<script >
|
||||
$(function() {
|
||||
$("table#characters").tablesorter({ sortList: [[0,0]] });
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Your Characters</h1>
|
||||
</div>
|
||||
@@ -41,6 +34,11 @@
|
||||
<p>You have no API keys linked to your auth account.</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script src="/static/js/jquery.tablesorter.min.js"></script>
|
||||
<script >
|
||||
$(function() {
|
||||
$("table#characters").tablesorter({ sortList: [[0,0]] });
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -6,32 +6,40 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="corporation_info">
|
||||
<h1>{{ corporation.name }}</h1>
|
||||
<div class="page-header">
|
||||
<h1>{{ corporation.name }}</h1>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li><b>Member Count:</b> {{ corporation.member_count }}</li>
|
||||
<li><b>Known Members:</b> {{ corporation.eveplayercharacter_set.count }}</li>
|
||||
{% if view_members %}
|
||||
<li><b>Full Director API Available: {% if corporation.director_api_keys %}<span style="color: green;">Yes</span>{% else %}<span style="color: red;">No</span>{% endif %}</b></li>
|
||||
<li><b>Members with API Keys:</b> {{ corporation.api_keys }}</li>
|
||||
<li><b>Members with Active API Keys:</b> {{ corporation.active_api_keys }}</li>
|
||||
<li><b>API Coverage:</b> {{ corporation.api_key_coverage|floatformat:2 }}%</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<p>
|
||||
<ul>
|
||||
<li><b>Member Count:</b> {{ corporation.member_count }}</li>
|
||||
<li><b>Known Members:</b> {{ corporation.eveplayercharacter_set.count }}</li>
|
||||
{% if view_members %}
|
||||
<li><b>Full Director API Available: {% if corporation.director_api_keys %}<span class="label success">Yes</span>{% else %}<span class="label important">No</span>{% endif %}</b></li>
|
||||
<li><b>Members with API Keys:</b> {{ corporation.api_keys }}</li>
|
||||
<li><b>Members with Active API Keys:</b> {{ corporation.active_api_keys }}</li>
|
||||
<li><b>API Coverage:</b> {{ corporation.api_key_coverage|floatformat:2 }}%</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
{% if view_members %}
|
||||
<table>
|
||||
<tr><th>Name</th><th>Skillpoints</th><th>Join Date</th><th>Director?</th><th>Roles?</th><th>API Key?</th><th>Key Active?</th></tr>
|
||||
{% autopaginate members 20 %}
|
||||
{% for char in members %}
|
||||
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td><td>{% if char.total_sp %}{{ char.total_sp|intcomma }} SP{% endif %}</td><td>{{ char.corporation_date }}</td><td>{% if char.director %}Yes{% endif %}</td><td>{% if char.eveaccount_set.count %}{% if char.roles.count %}Yes{% else %}No{% endif %}{% endif %}<td>{% if char.eveaccount_set.count %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td><td>{% if char.active_key %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% paginate %}
|
||||
{% if view_members %}
|
||||
{% autopaginate members 25 %}
|
||||
<table class="zebra-striped" id="members">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Skillpoints</th><th>Join Date</th><th>Director?</th><th>Roles?</th><th>API Key?</th><th>Key Active?</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for char in members %}
|
||||
<tr><td><a href="{% url eveapi-character char.id %}">{{ char.name }}</a></td><td>{% if char.total_sp %}{{ char.total_sp|intcomma }} SP{% endif %}</td><td>{{ char.corporation_date }}</td><td>{% if char.director %}Yes{% endif %}</td><td>{% if char.eveaccount_set.count %}{% if char.roles.count %}Yes{% else %}No{% endif %}{% endif %}<td>{% if char.eveaccount_set.count %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td><td>{% if char.active_key %}Yes{% else %}<span style="color: red;">No</span>{% endif %}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><a href="{% url eveapi-corporation-members-csv corporation.id %}" class="btn" title="Exports the membership list of this corporation to a CSV file.">Export as CSV</a></p>
|
||||
{% endif %}
|
||||
<p>{% paginate %}</p>
|
||||
|
||||
<p><a href="{% url eveapi-corporation-members-csv corporation.id %}" class="btn" title="Exports the membership list of this corporation to a CSV file.">Export as CSV</a></p>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
12
app/eve_api/templates/eve_api/formfield.html
Normal file
12
app/eve_api/templates/eve_api/formfield.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% load add_class %}
|
||||
|
||||
<div class="clearfix">
|
||||
{{ field.label_tag }}
|
||||
<div class="input">
|
||||
{% if class %}{{ field|add_class:class }}{% else %}{{ field }}{% endif %}
|
||||
{% if field.help_text %}
|
||||
<span class="help-block">{{ field.help_text }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,17 +3,22 @@
|
||||
{% block title %}Update EVE API Key{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>Please update your API key as provided on the <a
|
||||
href="http://eve-online.com/api">EVE Online API
|
||||
page</a> and a optional description.</p>
|
||||
<div class="page-header">
|
||||
<h1>Update EVE API Key</h1>
|
||||
</div>
|
||||
|
||||
<p>Please update your API key as provided on the <a href="http://eve-online.com/api">EVE Online API page</a> and a optional description.</p>
|
||||
|
||||
<form action="{% url eveapi-update acc.api_user_id %}" method="post">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<br />
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Add Key" />
|
||||
<formset>
|
||||
|
||||
{% include "eve_api/formfield.html" with field=form.api_user_id %}
|
||||
{% include "eve_api/formfield.html" with field=form.api_key class="xxlarge" %}
|
||||
{% include "eve_api/formfield.html" with field=form.description class="xxlarge" %}
|
||||
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Add API Key" class="btn primary"/>
|
||||
</formset>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
21
app/eve_api/templatetags/add_class.py
Normal file
21
app/eve_api/templatetags/add_class.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import re
|
||||
from django.utils.safestring import mark_safe
|
||||
from django import template
|
||||
register = template.Library()
|
||||
|
||||
class_re = re.compile(r'(?<=class=["\'])(.*)(?=["\'])')
|
||||
@register.filter
|
||||
def add_class(value, css_class):
|
||||
string = unicode(value)
|
||||
match = class_re.search(string)
|
||||
if match:
|
||||
m = re.search(r'^%s$|^%s\s|\s%s\s|\s%s$' % (css_class, css_class,
|
||||
css_class, css_class),
|
||||
match.group(1))
|
||||
print match.group(1)
|
||||
if not m:
|
||||
return mark_safe(class_re.sub(match.group(1) + " " + css_class,
|
||||
string))
|
||||
else:
|
||||
return mark_safe(string.replace('>', ' class="%s">' % css_class))
|
||||
return value
|
||||
Reference in New Issue
Block a user