diff options
Diffstat (limited to 'strichliste.lua')
-rwxr-xr-x | strichliste.lua | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/strichliste.lua b/strichliste.lua index c0f73a2..818cdab 100755 --- a/strichliste.lua +++ b/strichliste.lua @@ -204,9 +204,9 @@ local function r_user_post(username) log:flush() log:close() return string.format([[ - <div class=\"notif\"><p>Transaction successful: <strong class=\"amount-%s\">%.02f€</strong> (%s)</p></div> - <audio src="%s" autoplay></audio> - ]], + <div class="notif"><p>Transaction successful: <strong class="amount-%s">%.02f€</strong> (%s)</p></div> + <audio src="%s" autoplay></audio> + ]], amount >= 0 and "pos" or "neg", amount / 100, escape(comment), config.transaction_sound or "" @@ -277,11 +277,27 @@ local function r_log(filter) print("<tr><th>Time</th><th>Username</th><th>Amount</th><th>Comment</th></tr>") for time, username, amount, comment in read_log() do if filter == nil or filter == username then - print(string.format( - "<tr><td>%d (%s ago)</td><td>%s</td><td class=\"amount-%s\">%.02f€</td><td>%s</td></tr>", + print(string.format([[ + <tr> + <td>%d (%s ago)</td> + <td>%s</td> + <td class=\"amount-%s\">%.02f€</td> + <td>%s</td> + <td> + <form action="/%s" method="POST"> + <input type="number" name="amount" id="amount" value="%d" hidden /> + <input type="text" name="comment" id="comment" value="Revert %s" hidden /> + <input type="submit" value="Revert" /> + </form> + </td> + </tr> + ]], time, format_duration(os.time() - time), escape(username), amount >= 0 and "pos" or "neg", amount / 100, + escape(comment), + escape(username), + -amount, escape(comment) )) end |