mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2025-01-30 18:51:41 +00:00
expand inactive users when filter is applied
This commit is contained in:
parent
8e02438ea7
commit
15f4cc0c85
1 changed files with 29 additions and 27 deletions
|
@ -536,8 +536,8 @@ local function r_users(show_special, filter_negative)
|
|||
end
|
||||
|
||||
return respond(200, "Abrechenbarkeit", function()
|
||||
local users = get_active_users()
|
||||
|
||||
local users = get_active_users()
|
||||
|
||||
if not show_special then
|
||||
print(format([[
|
||||
<form class="section" action="/" method="GET" id="user_creation">
|
||||
|
@ -548,34 +548,34 @@ local function r_users(show_special, filter_negative)
|
|||
</form>
|
||||
]]))
|
||||
|
||||
-- get first letters
|
||||
local firstletters = {}
|
||||
local function contains(char)
|
||||
for _, firstchar in ipairs(firstletters) do
|
||||
if firstchar == char then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- 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
|
||||
return false
|
||||
end
|
||||
|
||||
table.sort(firstletters)
|
||||
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>]])
|
||||
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
|
||||
print([[<div class="userlist"></div>]]) -- for printing
|
||||
print([[<ul class="userlist">]])
|
||||
|
@ -624,7 +624,9 @@ local function r_users(show_special, filter_negative)
|
|||
|
||||
return
|
||||
end
|
||||
print(format([[<details><summary>{+users.inactive_list}</summary><ul class="userlist">]]))
|
||||
print(format([[
|
||||
<details {oclass}><summary>{+users.inactive_list}</summary><ul class="userlist">
|
||||
]], { oclass = query.prefix and "open" or "" }))
|
||||
for _, user in ipairs(users) do
|
||||
if user.time <= inactive_cutoff then show_user(user) end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue