Gold goal popup: add yesterday's progress

This commit is contained in:
Chad Birch
2013-10-28 17:11:03 -06:00
parent 3cfa44b29e
commit 95ab8367a7
3 changed files with 65 additions and 28 deletions

View File

@@ -4298,8 +4298,11 @@ class Goldvertisement(Templated):
def __init__(self):
today = datetime.datetime.now(g.display_tz).date()
revenue_today = gold_revenue_on(today)
yesterday = today - datetime.timedelta(days=1)
revenue_yesterday = gold_revenue_on(yesterday)
revenue_goal = g.live_config["gold_revenue_goal"]
self.percent_filled = int((revenue_today / revenue_goal) * 100)
self.percent_filled_yesterday = int((revenue_yesterday / revenue_goal) * 100)
self.hours_paid = ServerSecondsBar.current_value_of_month()
Templated.__init__(self)

View File

@@ -7425,6 +7425,37 @@ body.post-under-6h-old .gilded-comment-icon {
body.gold .buttons li.comment-save-button { display: inline; }
.gold-progress (@bar-height: 17px) {
padding: 7px 0;
.bar {
border: 1px solid #dad0b3;
height: @bar-height;
overflow: auto;
border-radius: 10px;
span {
display: block;
height: 100%;
background-color: #f3e287;
background-image: -webkit-linear-gradient(top, #fff8ba, #eccf90);
background-image: linear-gradient(to bottom, #fff8ba 0%, #eccf90 100%);
border-radius: (@bar-height/2);
}
}
p {
float: right;
font-weight: bold;
font-size: @bar-height - 2;
color: #5a3f1a;
line-height: @bar-height + 2; // +2 to match border on bar
margin-left: 6px;
margin-top: 0;
}
}
.goldvertisement {
@border-color: #c4b487;
@background-shadow: #dad0b3;
@@ -7453,34 +7484,7 @@ body.gold .buttons li.comment-save-button { display: inline; }
}
.progress {
@bar-height: 17px;
padding: 7px 0;
.bar {
border: 1px solid #dad0b3;
height: @bar-height;
overflow: auto;
border-radius: 10px;
span {
display: block;
height: 100%;
background-color: #f3e287;
background-image: -webkit-linear-gradient(top, #fff8ba, #eccf90);
background-image: linear-gradient(to bottom, #fff8ba 0%, #eccf90 100%);
border-radius: (@bar-height/2);
}
}
p {
float: right;
font-weight: bold;
font-size: 15px;
color: #5a3f1a;
line-height: @bar-height + 2; // +2 to match border on bar
margin-left: 6px;
}
.gold-progress
}
a {
@@ -7558,6 +7562,25 @@ body.gold .buttons li.comment-save-button { display: inline; }
color: inherit;
}
}
div.history {
margin: 5px;
padding-top: 2px;
border-top: 1px solid #e2ddcf;
p {
margin-bottom: 0;
}
.progress {
.gold-progress(12px);
opacity: 0.8;
p {
font-weight: normal;
}
}
}
}
#stripe-payment th {

View File

@@ -54,6 +54,17 @@
<p class="aside">This daily goal updates every 10 minutes and is reset at
midnight&#32;<a target="_blank"
href="http://en.wikipedia.org/wiki/Mountain_Standard_Time">MST</a>.</p>
<div class="history">
<p>${_("Yesterday's reddit gold goal")}</p>
<div class="progress">
<p>${format_percent(thing.percent_filled_yesterday / 100.0, locale=c.locale)}</p>
<div class="bar">
<span style="width: ${min(100, thing.percent_filled_yesterday)}%"></span>
</div>
</div>
</div>
</div>
</div>
</div>