From 988a567bc17549c0bc136c237248d5a78e5c4cca Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 2 Jan 2017 05:38:39 -0500 Subject: [PATCH] Implement individual operation pages. --- static/campaigns.css | 66 +++++++++++++++++++++++++++++--- static/campaigns.js | 2 +- templates/campaigns/operation.mako | 42 ++++++++++++++++++++- templates/campaigns/renderers.mako | 77 +++++++++++++++++++++++++++----------- 4 files changed, 157 insertions(+), 30 deletions(-) diff --git a/static/campaigns.css b/static/campaigns.css index f235e7a..a9d2418 100644 --- a/static/campaigns.css +++ b/static/campaigns.css @@ -29,6 +29,15 @@ h2 .disabled-info { font-variant: none; } +.breadcrumb { + margin-top: 1em; + font-size: 90%; +} + +.breadcrumb::after { + content: "ยป"; +} + #operations { margin-bottom: 1em; } @@ -72,6 +81,7 @@ h2 .disabled-info { .operation .summary .head { margin-top: 1em; + font-weight: normal; } .operation .summary .contents { @@ -110,10 +120,14 @@ h2 .disabled-info { padding-right: 0.5em; } -.operation .board .icon { +.operation:not(.detail) .board .icon { width: 46px; } +.operation.detail .board .icon { + width: 52px; +} + .operation .board.expanded { position: absolute; z-index: 1; @@ -121,7 +135,7 @@ h2 .disabled-info { clip-path: inset(0 100% 0 0); } -.operation .board:not(.expanded) .extra { +.operation:not(.detail) .board:not(.expanded) .extra { display: none; } @@ -130,15 +144,27 @@ h2 .disabled-info { } .operation .board img { + vertical-align: middle; +} + +.operation:not(.detail) .board img { width: 42px; height: 42px; - vertical-align: middle; +} + +.operation.detail .board img { + width: 48px; + height: 48px; } .operation .board abbr { border-bottom: none; } +.operation .board a:hover { + text-decoration: none; +} + .operation .itemboard td:last-child { padding-left: 0.5em; text-align: right; @@ -154,6 +180,36 @@ h2 .disabled-info { color: #AAA; } +.operation.detail { + margin-bottom: 1em; +} + +.operation.detail .overview { + margin-left: 1em; +} + +.operation.detail .primary, .operation.detail .primary .unit { + display: inline-block; +} + +.operation.detail .unit { + margin-left: 0.15em; +} + +.operation.detail .contents, .operation.detail .board:not(.expanded) { + width: 100%; +} + +.operation.detail .detail-item { + padding-left: 0.5em; +} + +.operation.detail .detail-list > :not(:last-child)::after { + margin-left: 0.25em; + content: "/"; + color: #AAA; +} + @media (min-width: 800px) { #operations { margin: 1em 0; @@ -163,12 +219,12 @@ h2 .disabled-info { margin-bottom: 2em; } - .operation { + .operation:not(.detail) { margin: 0 0.75em; text-align: center; } - .operation .secondary { + .operation:not(.detail) .secondary { margin-top: 0.5em; } diff --git a/static/campaigns.js b/static/campaigns.js index 30ca5fe..addf9f7 100644 --- a/static/campaigns.js +++ b/static/campaigns.js @@ -6,7 +6,7 @@ $(function() { $('#campaigns-select input[type="submit"]').hide(); //Selectively reveal operation summary details: - $(".operation .killboard tr").mouseenter(function() { + $(".operation:not(.detail) .killboard tr").mouseenter(function() { var div = $("", {addClass: "board expanded"}) .css($(this).position()) .css("background-color", $(this).css("background-color")) diff --git a/templates/campaigns/operation.mako b/templates/campaigns/operation.mako index 9828ca4..f2a50e4 100644 --- a/templates/campaigns/operation.mako +++ b/templates/campaigns/operation.mako @@ -1,4 +1,8 @@ +<%! + from calefaction.format import format_isk +%> <%inherit file="../_default.mako"/> +<%namespace file="renderers.mako" import="render_summary"/> <%block name="title"> ${self.support.maketitle(operation["title"], campaign["title"], "Campaigns")} @@ -8,8 +12,42 @@ <%block name="extrajs"> ${self.support.makejs("campaigns.js")} -

+ +

Operation: ${operation["title"] | h} + % if not enabled: + + % endif

-

...

+
+ <% + mod = g.config.modules.campaigns + primary, secondary = mod.get_overview(cname, opname) + summary, renderer = mod.get_summary(cname, opname, limit=-1) + klass = "big" if primary < 1000 else "medium" if primary < 1000000 else "small" + punit = mod.get_unit(operation, primary) + sunit = mod.get_unit(operation, secondary, primary=False) + %> +
+
+ ${"{:,}".format(primary)} +
${punit}
+
+ % if secondary is not None: +
+ + ${format_isk(secondary) | h} + ${sunit} + +
+ % endif +
+ % if summary: +
+ ${render_summary(renderer, summary, detail=True)} +
+ % endif +
diff --git a/templates/campaigns/renderers.mako b/templates/campaigns/renderers.mako index b4ad832..366cf31 100644 --- a/templates/campaigns/renderers.mako +++ b/templates/campaigns/renderers.mako @@ -3,7 +3,7 @@ format_quantity, format_isk_compact, format_utctime_compact, format_security, get_security_class) %> -<%def name="_killboard_kill(kill)"> +<%def name="_killboard_kill(kill, detail, any_alliances, any_factions)"> <% victim = kill["victim"] system = g.eve.universe.system(kill["system"]) @@ -30,28 +30,49 @@ ${victim['char_name'] | h} + % if detail: + + % endif - % endif - - % endif - - % if not victim["alliance_id"] and not victim["faction_id"]: + % if not detail and (any_alliances or any_factions) and not victim["alliance_id"] and not victim["faction_id"]: % endif + % if detail: + + % endif <%def name="_itemboard_item(item)"> @@ -72,18 +93,30 @@ -<%def name="_killboard_recent(summary)"> -
Most recent kills:
+<%def name="_killboard_recent(summary, detail)"> + % if detail: +

Kills:

+ % else: +
Most recent kills:
+ % endif + <% + any_alliances = any(kill["victim"]["alliance_id"] for kill in summary) + any_factions = any(kill["victim"]["faction_id"] for kill in summary) + %>
+ ${victim['char_name'] | h} + (${killed.name | h}) + ${victim['corp_name'] | h} - % if victim["alliance_id"]: - - ${victim['alliance_name'] | h} - + % if any_alliances: + + % if victim["alliance_id"]: + + ${victim['alliance_name'] | h} + + % endif + - % if victim["faction_id"]: - - ${victim['faction_name'] | h} - + % if any_factions: + + % if victim["faction_id"]: + + ${victim['faction_name'] | h} + + % endif + + ${victim['corp_name'] | h} + % if victim['alliance_name']: + ${victim['alliance_name'] | h} + % endif + % if victim['faction_name']: + ${victim['faction_name'] | h} + % endif +
% for kill in summary: - ${_killboard_kill(kill)} + ${_killboard_kill(kill, detail, any_alliances, any_factions)} % endfor
-<%def name="_collection_items(summary)"> -
Top items:
+<%def name="_collection_items(summary, detail)"> + % if detail: +

Items:

+ % else: +
Top items:
+ % endif
% for item in summary: @@ -93,10 +126,10 @@ -<%def name="render_summary(renderer, summary)"><% +<%def name="render_summary(renderer, summary, detail=False)"><% if renderer == "killboard_recent": - return _killboard_recent(summary) + return _killboard_recent(summary, detail) if renderer == "collection_items": - return _collection_items(summary) + return _collection_items(summary, detail) raise RuntimeError("Unknown renderer: %s" % renderer) %>