Explorar el Código

Campaign module style tweaks.

master
Ben Kurtovic hace 5 años
padre
commit
de863465d2
Se han modificado 3 ficheros con 32 adiciones y 17 borrados
  1. +6
    -3
      calefaction/modules/campaigns/getters.py
  2. +18
    -10
      static/main.css
  3. +8
    -4
      templates/campaigns/campaign.mako

+ 6
- 3
calefaction/modules/campaigns/getters.py Ver fichero

@@ -12,6 +12,8 @@ from ...database import Database as MainDB

__all__ = ["get_current", "get_overview", "get_summary", "get_unit"]

_MAX_STALENESS = 60 * 60

CampaignDB.path = str(Path(MainDB.path).parent / "db_campaigns.sqlite3")

app.before_request(CampaignDB.pre_hook)
@@ -28,8 +30,8 @@ def _update_operation(cname, opname, new):
qualifiers = operation["qualifiers"]
show_isk = operation.get("isk", True)

primary = 42
secondary = 63
primary = __import__("random").randint(10, 99)
secondary = __import__("random").randint(100000, 50000000)
g.campaign_db.set_overview(cname, opname, primary, secondary)

def get_current():
@@ -49,13 +51,14 @@ def get_overview(cname, opname):

Updates the database if necessary, so this can take some time.
"""
maxdelta = timedelta(seconds=_MAX_STALENESS)
with _lock:
last_updated = g.campaign_db.check_operation(cname, opname)
if last_updated is None:
logger.debug("Adding campaign=%s operation=%s", cname, opname)
_update_operation(cname, opname, new=True)
g.campaign_db.add_operation(cname, opname)
elif datetime.utcnow() - last_updated > timedelta(seconds=60 * 60):
elif datetime.utcnow() - last_updated > maxdelta:
logger.debug("Updating campaign=%s operation=%s", cname, opname)
_update_operation(cname, opname, new=False)
g.campaign_db.touch_operation(cname, opname)


+ 18
- 10
static/main.css Ver fichero

@@ -376,30 +376,30 @@ h2 .disabled::after {
justify-content: space-between;
}

.operation .overview .primary {
line-height: 60px;
.operation .primary .num {
height: 60px;
line-height: 60px;
}

.operation .overview .primary.big {
.operation .big {
font-size: 300%;
}

.operation .overview .primary.medium {
.operation .medium {
font-size: 200%;
}

.operation .overview .primary.small {
.operation .small {
font-size: 150%;
}

.operation .overview .unit {
.operation .unit {
font-style: italic;
}

@media (min-width: 800px) {
#operations {
margin: 1em;
margin: 1em 2em;
}

#operations section {
@@ -410,6 +410,14 @@ h2 .disabled::after {
margin: 0 0.75em;
text-align: center;
}

.operation .secondary {
margin-top: 0.5em;
}

.operation .secondary .unit {
margin-left: 0.15em;
}
}

@media (max-width: 799px) {
@@ -421,12 +429,12 @@ h2 .disabled::after {
margin: 0.5em 0;
}

.operation .overview > div {
.operation .primary, .operation .primary .unit {
display: inline-block;
}

.operation .overview .unit {
margin-left: 0.25em;
.operation .unit {
margin-left: 0.15em;
}
}



+ 8
- 4
templates/campaigns/campaign.mako Ver fichero

@@ -23,11 +23,15 @@
<a href="${url_for('campaigns.operation', cname=name, opname=opname)}">${operation["title"] | h}</a>
</h3>
<div class="overview">
<div class="primary ${klass}">${"{:,}".format(primary)}</div>
<div class="unit">${mod.get_unit(operation, primary)}</div>
<div class="primary">
<span class="num ${klass}">${"{:,}".format(primary)}</span>
<div class="unit">${mod.get_unit(operation, primary)}</div>
</div>
% if secondary is not None:
<div class="secondary">${"{:,}".format(secondary)}</div>
<div class="unit">${mod.get_unit(operation, secondary, primary=False)}</div>
<div class="secondary">
<span class="num">${"{:,}".format(secondary)}</span>
<span class="unit">${mod.get_unit(operation, secondary, primary=False)}</span>
</div>
% endif
</div>
% if summary:


Cargando…
Cancelar
Guardar