From da4c51e1efc86054c17678b5c627ed18ddaf2328 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sun, 28 Jun 2015 21:49:24 -0700 Subject: [PATCH] code to count down date of end of campaign --- Gemfile.lock | 3 +++ app_helpers.rb | 10 ++++++++++ views/home.erb | 4 ++-- views/index.erb | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 66a46bdf..2d23c77d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -311,3 +311,6 @@ DEPENDENCIES timecop webmock zipruby + +BUNDLED WITH + 1.10.2 diff --git a/app_helpers.rb b/app_helpers.rb index 1952a520..b05f49a7 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -1,3 +1,13 @@ +def kickstarter_days_remaining + ending = Time.parse('Sat, Jul 25 2015 3:05 PM PDT') + today = Time.now + + remaining = ending - today + return 0 if remaining < 0 + + ((ending - today) / 86400).to_i +end + def dashboard_if_signed_in redirect '/dashboard' if signed_in? end diff --git a/views/home.erb b/views/home.erb index 048c23a4..910e740a 100644 --- a/views/home.erb +++ b/views/home.erb @@ -23,9 +23,9 @@

The Neocities Kickstarter: An HTML/CSS course for everyone

-

26 days left to get Neocities rewards and support our education goals! Learn More >>

+

<%= kickstarter_days_remaining %> days left to get Neocities rewards and support our education goals! Learn More >>

- + <% if site.site_changed == false || site.changed_count == 0 %>

Thanks for joining the Neocities community!

diff --git a/views/index.erb b/views/index.erb index 2cb0dbca..9bc3b341 100644 --- a/views/index.erb +++ b/views/index.erb @@ -70,7 +70,7 @@ SUPPORT OUR - 28 DAYS LEFT + <%= kickstarter_days_remaining %> DAYS LEFT

We need your help to build an amazing HTML/CSS course into Neocities! Learn More >>