From 9df604a203959e1828ba715e5776f86861391a74 Mon Sep 17 00:00:00 2001 From: dreamer Date: Fri, 16 Oct 2020 15:09:39 +0200 Subject: [PATCH] add pagination navigator --- code/handlers/stationhandler.lua | 7 ++++--- code/views/layout.etlua | 6 ++++++ code/views/station.etlua | 10 ++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/code/handlers/stationhandler.lua b/code/handlers/stationhandler.lua index 81da44d..a11bd44 100644 --- a/code/handlers/stationhandler.lua +++ b/code/handlers/stationhandler.lua @@ -58,9 +58,10 @@ local function Stationhandler(self) return { json = self.airtimes } end - -- for i, item in ipairs(self.airtimes) do - -- print(to_json(item)) - -- end + + self.station_id = station_id + self.offset = tonumber(offset) + self.limit = tonumber(limit) return { render = "station" } diff --git a/code/views/layout.etlua b/code/views/layout.etlua index 83d99e1..6b2f3c1 100644 --- a/code/views/layout.etlua +++ b/code/views/layout.etlua @@ -13,6 +13,12 @@ margin: auto; text-align:center; } + + .scroll { + font-size: 20px; + margin: auto; + text-align:center; + } diff --git a/code/views/station.etlua b/code/views/station.etlua index 5939ca2..e702389 100644 --- a/code/views/station.etlua +++ b/code/views/station.etlua @@ -1,5 +1,15 @@ <% render("views.navigation") %> +
+<% if offset > 0 then %> + ">previous +<% end %> +- +<% if table.getn(airtimes) >= limit then %> + ">next +<% end %> +
+
<% for i, item in ipairs(airtimes) do %>