mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
merge
This commit is contained in:
parent
56ee146ec9
commit
e263b806c6
3 changed files with 73 additions and 7 deletions
|
@ -532,6 +532,8 @@ end
|
||||||
|
|
||||||
local function r_users(show_special)
|
local function r_users(show_special)
|
||||||
return respond(200, "Abrechenbarkeit", function()
|
return respond(200, "Abrechenbarkeit", function()
|
||||||
|
local users = get_active_users()
|
||||||
|
|
||||||
if not show_special then
|
if not show_special then
|
||||||
print(format([[
|
print(format([[
|
||||||
<form action="/" method="GET" id="user_creation">
|
<form action="/" method="GET" id="user_creation">
|
||||||
|
@ -541,9 +543,39 @@ local function r_users(show_special)
|
||||||
<input type="submit" value="{+index.form.create_user.submit}" class="button amount-ntr" />
|
<input type="submit" value="{+index.form.create_user.submit}" class="button amount-ntr" />
|
||||||
</form>
|
</form>
|
||||||
]]))
|
]]))
|
||||||
|
|
||||||
|
-- get first letters
|
||||||
|
local firstletters = {}
|
||||||
|
local function contains(char)
|
||||||
|
for _, firstchar in ipairs(firstletters) do
|
||||||
|
if firstchar == char then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, user in ipairs(users) do
|
||||||
|
user.firstchar = user.name:sub(1,1):lower()
|
||||||
|
if user.firstchar ~= "@" and not contains(user.firstchar) then
|
||||||
|
table.insert(firstletters, user.firstchar)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.sort(firstletters)
|
||||||
|
|
||||||
|
print(format([[<section class="firstletterlist"><h3>{+users.filter}</h3><ul>]]))
|
||||||
|
for k, letter in ipairs(firstletters) do
|
||||||
|
print(format([[<li><a href="?users&prefix={letter}">{letter}</a></li>]], {
|
||||||
|
letter = letter,
|
||||||
|
}))
|
||||||
|
end
|
||||||
|
print([[</ul></section>]])
|
||||||
end
|
end
|
||||||
print([[<div class="userlist"></div>]]) -- for printing
|
print([[<div class="userlist"></div>]]) -- for printing
|
||||||
print([[<ul class="userlist">]])
|
print([[<ul class="userlist">]])
|
||||||
|
|
||||||
local show_user = function(user)
|
local show_user = function(user)
|
||||||
local is_spu = user.name:sub(1, 1) == "@"
|
local is_spu = user.name:sub(1, 1) == "@"
|
||||||
local filter_out = query.prefix ~= nil and user.name:sub(1,1):lower() ~= query.prefix
|
local filter_out = query.prefix ~= nil and user.name:sub(1,1):lower() ~= query.prefix
|
||||||
|
@ -566,7 +598,7 @@ local function r_users(show_special)
|
||||||
end
|
end
|
||||||
print("</ul>")
|
print("</ul>")
|
||||||
print(format([[<details><summary>{+users.inactive_list}</summary><ul class="userlist">]]))
|
print(format([[<details><summary>{+users.inactive_list}</summary><ul class="userlist">]]))
|
||||||
for _, user in ipairs(get_active_users()) do
|
for _, user in ipairs(users) do
|
||||||
if user.time <= inactive_cutoff then show_user(user) end
|
if user.time <= inactive_cutoff then show_user(user) end
|
||||||
end
|
end
|
||||||
print([[</ul></details>]])
|
print([[</ul></details>]])
|
||||||
|
|
|
@ -53,6 +53,7 @@ user.form.transaction.success=Transaction successful
|
||||||
spus=SPUs
|
spus=SPUs
|
||||||
users=Users
|
users=Users
|
||||||
user.special=This is a special user.
|
user.special=This is a special user.
|
||||||
|
users.filter=Filter
|
||||||
error.unknown_product=Unknown product
|
error.unknown_product=Unknown product
|
||||||
error.invalid_amount=Amount invalid
|
error.invalid_amount=Amount invalid
|
||||||
error.invalid_comment=Comment invalid
|
error.invalid_comment=Comment invalid
|
||||||
|
|
45
style.css
45
style.css
|
@ -123,31 +123,64 @@ form#user_creation>* {
|
||||||
margin-right: 1.5em;
|
margin-right: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.userlist>li a {
|
ul.userlist>li a, .firstletterlist>ul>li a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.userlist {
|
.firstletterlist>h3 {
|
||||||
|
margin: 5px;
|
||||||
|
margin-right: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.userlist, .firstletterlist {
|
||||||
|
padding: 1em;
|
||||||
|
padding-top: 0;
|
||||||
|
margin-top: 2em;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.userlist, .firstletterlist>ul {
|
||||||
display: grid;
|
display: grid;
|
||||||
justify-content: left;
|
justify-content: left;
|
||||||
grid-auto-rows: minmax(5em, auto);
|
grid-auto-rows: minmax(5em, auto);
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(8em, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(8em, 1fr));
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.userlist>li>a {
|
.firstletterlist {
|
||||||
|
background-color: var(--b2);
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.firstletterlist>ul {
|
||||||
|
grid-auto-rows: minmax(2em, auto);
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(3em, 1fr));
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.userlist>li a, .firstletterlist>ul>li a {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: var(--b2);
|
background-color: var(--b2);
|
||||||
|
border-radius: 4px;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 6em;
|
width: 6em;
|
||||||
height: 3.5em;
|
height: 3.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.firstletterlist>ul>li a {
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: var(--b0);
|
||||||
|
padding: .2em;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
width: 1.6em;
|
||||||
|
height: 1.6em;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
Loading…
Reference in a new issue