From 95ab8367a71ae1240d7bcd8052fa37ae242e0eef Mon Sep 17 00:00:00 2001 From: Chad Birch Date: Mon, 28 Oct 2013 17:11:03 -0600 Subject: [PATCH] Gold goal popup: add yesterday's progress --- r2/r2/lib/pages/pages.py | 3 ++ r2/r2/public/static/css/reddit.less | 79 ++++++++++++++++++---------- r2/r2/templates/goldvertisement.html | 11 ++++ 3 files changed, 65 insertions(+), 28 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index eca4ba414..7f0afd366 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -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) diff --git a/r2/r2/public/static/css/reddit.less b/r2/r2/public/static/css/reddit.less index 30a4b5ec0..5c4d977ad 100755 --- a/r2/r2/public/static/css/reddit.less +++ b/r2/r2/public/static/css/reddit.less @@ -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 { diff --git a/r2/r2/templates/goldvertisement.html b/r2/r2/templates/goldvertisement.html index 2aa927471..2ea0cfedb 100644 --- a/r2/r2/templates/goldvertisement.html +++ b/r2/r2/templates/goldvertisement.html @@ -54,6 +54,17 @@

This daily goal updates every 10 minutes and is reset at midnight MST.

+ +
+

${_("Yesterday's reddit gold goal")}

+ +
+

${format_percent(thing.percent_filled_yesterday / 100.0, locale=c.locale)}

+
+ +
+
+