%! import humanize %>
<%inherit file="../_default.mako"/>
<%namespace file="renderers.mako" import="render_summary"/>
<%block name="title">
${self.maketitle(campaign["title"], "Campaigns")}
%block>
Campaign:
${campaign["title"] | h}
% if not enabled:
✘
% endif
<% mod = g.config.modules.campaigns %>
% for section in campaign["layout"]:
<% klass = "loose" if len(section) < 3 else "tight" %>
% for opname in section:
<%
operation = campaign["operations"][opname]
primary, secondary = mod.get_overview(name, opname)
summary, renderer = mod.get_summary(name, opname, limit=5)
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:
${humanize.intword(secondary) | h}
${sunit}
% endif
% if summary:
${render_summary(renderer, summary)}
% endif
% endfor
% endfor