Added messages when the competition has not begun or finished
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 17 Sep 2019 22:51:16 +0000 (17:51 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 17 Sep 2019 22:51:16 +0000 (17:51 -0500)
codebox/middleware/competition_started.moon
codebox/middleware/during_competition.moon
codebox/views/competition/Tupfile [new file with mode: 0644]
codebox/views/competition/finished.moon [new file with mode: 0644]
codebox/views/competition/not_started.moon [new file with mode: 0644]

index b04ed9d76471e669fc08111dc960f370e42b62d2..bee3a2f72bce3b9d6c9f56a2a7e7b52795a3ee81 100644 (file)
@@ -11,4 +11,4 @@ import Competitions from require 'models'
     start_time = time_to_number @competition.start
 
     unless start_time <= current_time
-        @write '<h1>Competition has not begun</h1>'
\ No newline at end of file
+        @write render: 'competition.not_started'
\ No newline at end of file
index a5a23034ae68b97cd8ebb11bad84c218b678d8a2..51b4e48a0badeb2f78050ce3fd5b0427c062c006 100644 (file)
@@ -12,6 +12,6 @@ import Competitions from require 'models'
     end_time = time_to_number @competition.end
 
     unless start_time <= current_time
-        @write '<h1>Competition has not begun</h1>'
+        @write render: 'competition.not_started'
     unless current_time <= end_time
-        @write '<h1>Competition has ended</h1>'
\ No newline at end of file
+        @write render: 'competition.finished'
\ No newline at end of file
diff --git a/codebox/views/competition/Tupfile b/codebox/views/competition/Tupfile
new file mode 100644 (file)
index 0000000..71f051b
--- /dev/null
@@ -0,0 +1 @@
+include_rules
\ No newline at end of file
diff --git a/codebox/views/competition/finished.moon b/codebox/views/competition/finished.moon
new file mode 100644 (file)
index 0000000..a1695a1
--- /dev/null
@@ -0,0 +1,6 @@
+html = require 'lapis.html'
+
+class CompetitionFinished extends html.Widget
+    content: =>
+        h1 'Competition has ended'
+        h3 style: 'text-align: center', -> text "Ended at #{@competition.end}"
\ No newline at end of file
diff --git a/codebox/views/competition/not_started.moon b/codebox/views/competition/not_started.moon
new file mode 100644 (file)
index 0000000..6d7d2b6
--- /dev/null
@@ -0,0 +1,7 @@
+html = require 'lapis.html'
+
+class CompetitionNotStarted extends html.Widget
+    content: =>
+        h1 'Competition has not started'
+
+        h3 style: 'text-align: center', -> text "Starts at #{@competition.start}"
\ No newline at end of file