mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2025-01-30 18:51:41 +00:00
improved things
This commit is contained in:
parent
2eb6754ca4
commit
a98f08d6c2
1 changed files with 12 additions and 7 deletions
|
@ -115,9 +115,9 @@ local function form_data()
|
|||
end
|
||||
|
||||
local function format_duration(t)
|
||||
if t > 86400 then return string.format("%d days", t / 86400) end
|
||||
if t > 3600 then return string.format("%d hours", t / 3600) end
|
||||
if t > 60 then return string.format("%d minutes", t / 60) end
|
||||
if t > 86400 then return string.format("%d day%s", t / 86400, math.floor(t / 86400) ~= 1 and "s" or "") end
|
||||
if t > 3600 then return string.format("%d hour%s", t / 3600, math.floor(t / 3600) ~= 1 and "s" or "") end
|
||||
if t > 60 then return string.format("%d minute%s", t / 60, math.floor(t / 60) ~= 1 and "s" or "") end
|
||||
return string.format("%d seconds", t)
|
||||
end
|
||||
|
||||
|
@ -253,7 +253,7 @@ local function r_user(username)
|
|||
<input type="submit" value="Buy" />
|
||||
</form>
|
||||
]])
|
||||
print("<div class=\"amount-presets\">")
|
||||
print([[<div class="amount-presets">]])
|
||||
for _, type in ipairs({ 1, -1 }) do
|
||||
for _, amount in ipairs({ 50, 100, 150, 200, 500, 1000 }) do
|
||||
print(string.format([[
|
||||
|
@ -281,7 +281,7 @@ local function r_log(filter)
|
|||
<tr>
|
||||
<td>%d (%s ago)</td>
|
||||
<td>%s</td>
|
||||
<td class=\"amount-%s\">%.02f€</td>
|
||||
<td class="amount-%s">%.02f€</td>
|
||||
<td>%s</td>
|
||||
<td>
|
||||
<form action="/%s" method="POST">
|
||||
|
@ -318,8 +318,13 @@ local function r_index()
|
|||
]])
|
||||
print("<ul>")
|
||||
for username, balance in pairs(balances()) do
|
||||
print(string.format("<li><a href=\"/%s\">%s</a>: %.02f€</li>", escape(username), escape(username),
|
||||
balance / 100))
|
||||
print(string.format([[
|
||||
<li><a href="/%s">%s</a>: <span class="amount-%s">%.02f€</span></li>
|
||||
]],
|
||||
urlencode(username),
|
||||
escape(username),
|
||||
balance >= 0 and "pos" or "neg", balance / 100
|
||||
))
|
||||
end
|
||||
print("</ul>")
|
||||
end)
|
||||
|
|
Loading…
Add table
Reference in a new issue