Browse Source

Display system name, security status for kills in campaign overview.

master
Ben Kurtovic 7 years ago
parent
commit
e390f83bf8
3 changed files with 67 additions and 8 deletions
  1. +11
    -1
      calefaction/format.py
  2. +45
    -1
      static/main.css
  3. +11
    -6
      templates/campaigns/renderers.mako

+ 11
- 1
calefaction/format.py View File

@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
import humanize

__all__ = ["format_isk", "format_isk_compact", "format_utctime",
"format_utctime_compact"]
"format_utctime_compact", "format_security", "get_security_class"]

def format_isk(value):
"""Nicely format an ISK value."""
@@ -64,3 +64,13 @@ def format_utctime_compact(value):
if delta < timedelta(seconds=1):
return "just now"
return "{} ago".format(_format_compact_delta(delta))

def format_security(value):
"""Given a system security status as a float, return a rounded string."""
return str(round(value, 1))

def get_security_class(value):
"""Given a system security status, return the corresponding CSS class."""
if value < 0.05:
return "sec-null"
return "sec-" + str(round(value, 1)).replace(".", "_")

+ 45
- 1
static/main.css View File

@@ -331,6 +331,50 @@ footer ul li:not(:last-child)::after {
margin-bottom: 1em;
}

.sec-null {
color: #F30202;
}

.sec-0_1 {
color: #DC3201;
}

.sec-0_2 {
color: #EB4903;
}

.sec-0_3 {
color: #F66301;
}

.sec-0_4 {
color: #E58000;
}

.sec-0_5 {
color: #F5F501;
}

.sec-0_6 {
color: #96F933;
}

.sec-0_7 {
color: #00FF00;
}

.sec-0_8 {
color: #02F34B;
}

.sec-0_9 {
color: #4BF3C3;
}

.sec-1_0 {
color: #33F9F9;
}

/* ================================ Modules ================================ */
/* ------------------------------- Campaigns ------------------------------- */

@@ -455,7 +499,7 @@ h2 .disabled-info {
.operation .killboard.expanded {
position: absolute;
z-index: 1;
transition: clip-path 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
transition: clip-path 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
clip-path: inset(0 100% 0 0);
}



+ 11
- 6
templates/campaigns/renderers.mako View File

@@ -1,22 +1,27 @@
<%!
from calefaction.format import format_isk_compact, format_utctime_compact
from calefaction.format import (
format_isk_compact, format_utctime_compact, format_security,
get_security_class)
%>
<%def name="_killboard_kill(kill)">
<% victim = kill["victim"] %>
<%
victim = kill["victim"]
system = g.eve.universe.system(kill["system"])
%>
<tr>
<td class="fluid">
<abbr title="${kill["date"].strftime("%Y-%m-%d %H:%M")}">${format_utctime_compact(kill["date"]) | h}</abbr><br/>
<a href="https://zkillboard.com/kill/${kill['id']}/">
<abbr title="${kill["date"].strftime("%Y-%m-%d %H:%M")}">${format_utctime_compact(kill["date"]) | h}</abbr><br/>
<abbr title="${"{:,.2f}".format(kill["value"])} ISK">${format_isk_compact(kill["value"]) | h}</abbr>
</a>
</td>
<td class="fluid extra">
${kill["system"]} 0.3<br/><!-- ... -->
Region<!-- ... -->
<a href="https://zkillboard.com/system/${system.id}/">${system.name}</a> <abbr title="${system.security}" class="${get_security_class(system.security)}">${format_security(system.security)}</abbr><br/>
<a href="https://zkillboard.com/region/${system.region.id}/">${system.region.name}</a>
</td>
<td class="icon">
<a href="https://zkillboard.com/kill/${kill['id']}/">
<img title="Kill ${kill['id']}" alt="Kill ${kill['id']}" src="${g.eve.image.inventory(victim["ship_id"], 64)}"/>
<img title="Kill ${kill['id']}: ..." alt="Kill ${kill['id']}: ..." src="${g.eve.image.inventory(victim["ship_id"], 64)}"/>
</a>
</td>
<td class="icon extra">


Loading…
Cancel
Save