diff options
-rw-r--r-- | app_test.py | 5 | ||||
-rw-r--r-- | pysite/views/main/countdown.py | 10 | ||||
-rw-r--r-- | static/js/countdown.js | 10 | ||||
-rw-r--r-- | templates/main/countdown.html | 36 | ||||
-rw-r--r-- | templates/main/index.html | 58 | ||||
-rw-r--r-- | templates/main/navigation.html | 6 |
6 files changed, 49 insertions, 76 deletions
diff --git a/app_test.py b/app_test.py index 651d7a96..2176fe08 100644 --- a/app_test.py +++ b/app_test.py @@ -32,11 +32,6 @@ class SiteTest(TestCase): class RootEndpoint(SiteTest): """ Test cases for the root endpoint and error handling """ - def test_countdown(self): - """ Check the countdown path responds with 200 OK """ - response = self.client.get('/countdown', "http://pytest.local") - self.assertEqual(response.status_code, 200) - def test_index(self): """ Check the root path reponds with 200 OK """ response = self.client.get('/', 'http://pytest.local') diff --git a/pysite/views/main/countdown.py b/pysite/views/main/countdown.py deleted file mode 100644 index f43d628c..00000000 --- a/pysite/views/main/countdown.py +++ /dev/null @@ -1,10 +0,0 @@ -# coding=utf-8 -from pysite.base_route import RouteView - - -class CountdownView(RouteView): - path = "/countdown" - name = "countdown" - - def get(self): - return self.render("main/countdown.html") diff --git a/static/js/countdown.js b/static/js/countdown.js index 5f5871d9..53553fb7 100644 --- a/static/js/countdown.js +++ b/static/js/countdown.js @@ -1,8 +1,4 @@ var heading = document.getElementById("countdown-title"); -var daysDisplay = document.getElementById("days"); -var hoursDisplay = document.getElementById("hours"); -var minutesDisplay = document.getElementById("minutes"); -var secondsDisplay = document.getElementById("seconds"); var startjam = new Date(Date.UTC(2018, 2, 23)); var endjam = new Date(Date.UTC(2018, 2, 26)); var goal; @@ -42,9 +38,7 @@ if (now+1000 >= endjam.getTime()) { if (seconds < 10) { seconds = "0"+seconds; } - daysDisplay.innerHTML = days; - hoursDisplay.innerHTML = hours; - minutesDisplay.innerHTML = minutes; - secondsDisplay.innerHTML = seconds; + let formatted = `${days}:${hours}:${minutes}:${seconds}` + document.getElementById('remaining').innerHTML = formatted; }, 100); } diff --git a/templates/main/countdown.html b/templates/main/countdown.html index 846883d3..8dd25564 100644 --- a/templates/main/countdown.html +++ b/templates/main/countdown.html @@ -2,29 +2,21 @@ {% block title %}Countdown{% endblock %} {% block og_title %}Countdown{% endblock %} {% block og_description %}Countdown for Code Jams.{% endblock %} +{% block beta_error %}{% endblock %} {% block content %} -<h1 id="countdown-title" class="uk-heading-primary uk-text-center">Code Jam Countdown</h1> -<div class="uk-section uk-section-muted"> - <div class="uk-container"> - <div class="uk-column-1 uk-column-1-2@s uk-column-1-4@m"> - <div class="uk-tile uk-padding-small"> - <h1 style="text-align: center">Days</h1> - <h1 id="days" class="uk-text-center" style="font-size: 200px">--</h1> - </div> - <div class="uk-tile uk-padding-small"> - <h1 style="text-align: center">Hours</h1> - <h1 id="hours" class="uk-text-center" style="font-size: 200px">--</h1> - </div> - <div class="uk-tile uk-padding-small"> - <h1 style="text-align: center">Minutes</h1> - <h1 id="minutes" class="uk-text-center" style="font-size: 200px">--</h1> - </div> - <div class="uk-tile uk-padding-small"> - <h1 style="text-align: center">Seconds</h1> - <h1 id="seconds" class="uk-text-center" style="font-size: 200px">--</h1> - </div> - </div> - </div> +<div class="uk-section-primary"> + + + + +<div class="uk-container uk-align-center"> + <h1 id="countdown-title" class="uk-heading-primary uk-text-center">Code Jam Countdown</h1> +<div class="uk-text-center"> + <h1 id="remaining"></h1> </div> +</div> +</div> + + <script src="/static/js/countdown.js"></script> {% endblock %}
\ No newline at end of file diff --git a/templates/main/index.html b/templates/main/index.html index 9084f305..7fb49df7 100644 --- a/templates/main/index.html +++ b/templates/main/index.html @@ -2,33 +2,41 @@ {% block title %}Home{% endblock %} {% block og_title %}Home{% endblock %} {% block content %} - <div class="uk-section uk-section-primary"> - <div class="uk-container uk-text-center"> - <h1 class="uk-header"> - Python Discord - </h1> - <p class="uk-text-lead"> - We're a large, friendly community focused around the Python programming language, - open to those who wish to learn the language or improve their skills, as well as - those looking to help others. - </p> +<div class="uk-section uk-section-primary"> + <div class="uk-container uk-text-center"> + <h1 class="uk-header"> + Python Discord + </h1> + <p class="uk-text-lead"> + We're a large, friendly community focused around the Python programming language, + open to those who wish to learn the language or improve their skills, as well as + those looking to help others. + </p> + <p> + We organise regular community events and have a dedicated staff of talented Python developers + available to assist around the clock. Whether you're looking to learn the language or working + on a complex project, we've got someone who can help you if you get stuck. + </p> + <div class="uk-container uk-align-center"> + <a href="/invite" class="uk-button uk-button-default uk-button-large "> + Join us on <i class="uk-icon fab fa-discord"></i> + </a> + </div> + <hr class="uk-divider-icon"/> + <div class="uk-container uk-container-small uk-text-meta"> <p> - We organise regular community events and have a dedicated staff of talented Python developers - available to assist around the clock. Whether you're looking to learn the language or working - on a complex project, we've got someone who can help you if you get stuck. + Please note: this site is under construction. What you see now may be vastly different + from the final project state. Feel free to chat to us on Discord if you're curious! </p> - <div class="uk-container uk-align-center"> - <a href="/invite" class="uk-button uk-button-default uk-button-large "> - Join us on <i class="uk-icon fab fa-discord"></i> - </a> - </div> - <hr class="uk-divider-icon" /> - <div class="uk-container uk-container-small uk-text-meta"> - <p> - Please note: this site is under construction. What you see now may be vastly different - from the final project state. Feel free to chat to us on Discord if you're curious! - </p> - </div> </div> + </div> +</div> + <div class="uk-align-center uk-text-center"> + <a href="/info/jams"><h1 id="countdown-title" class="uk-text-center">Code Jam Countdown</h1></a> + <div class="uk-text-center"> + <h1 id="remaining"></h1> + </div> + </div> +<script src='/static/js/countdown.js'></script> {% endblock %}
\ No newline at end of file diff --git a/templates/main/navigation.html b/templates/main/navigation.html index 385ad00d..cabd0d87 100644 --- a/templates/main/navigation.html +++ b/templates/main/navigation.html @@ -29,12 +29,6 @@ <li class="uk-nav-item uk-hidden@m"><a href="/"><i class="uk-icon fas fa-home"></i> Home</a></li> <li class="uk-nav-item uk-hidden@m"><a href="/invite"><i class="uk-icon fab fa-discord"></i> Discord</a></li> <li class="uk-nav-divider uk-hidden@m"></li> - - {% if current_page.startswith("countdown") %} - <li class="uk-active"><a href="/countdown">Code Jam Countdown</a></li> - {% else %} - <li><a href="/countdown">Code Jam Countdown</a></li> - {% endif %} {% if current_page.startswith("info") %} <li class="uk-nav-header uk-active"><a href="/info">Information</a></li> |