add pagination navigator

This commit is contained in:
dreamer 2020-10-16 15:09:39 +02:00
parent 1dd6538ae7
commit 9df604a203
3 changed files with 20 additions and 3 deletions

View File

@ -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" }

View File

@ -13,6 +13,12 @@
margin: auto;
text-align:center;
}
.scroll {
font-size: 20px;
margin: auto;
text-align:center;
}
</style>
</head>
<body>

View File

@ -1,5 +1,15 @@
<% render("views.navigation") %>
<div class="scroll">
<% if offset > 0 then %>
<a href="<%= url_for("station", { station = station_id }, { offset = offset-1 }) %>"><span style="color:#ffffff !important;">previous</span></a>
<% end %>
-
<% if table.getn(airtimes) >= limit then %>
<a href="<%= url_for("station", { station = station_id }, { offset = offset+1 }) %>"><span style="color:#ffffff !important;">next</span></a>
<% end %>
</div>
<div class="airtimes" style="background-color: black; width: 900px; margin:0 auto;">
<% for i, item in ipairs(airtimes) do %>
<div style="clear:both;height:5px;"></div>