mirror of
https://github.com/mt-mods/mail.git
synced 2025-05-04 10:21:43 -04:00
Fix sorters dropdowns go back to default
This commit is contained in:
parent
0d5ed5aca9
commit
49b1f0d400
3 changed files with 15 additions and 16 deletions
|
@ -24,15 +24,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
|
||||
-- then sort them
|
||||
|
||||
local sortfield = tostring(fields.sortfield)
|
||||
local sortdirection = tostring(fields.sortdirection)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
if not fields.sortfield or fields.sortfield == "" then
|
||||
sortfield = "3"
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
if not fields.sortdirection or fields.sortdirection == "" then
|
||||
sortdirection = "1"
|
||||
end
|
||||
|
||||
if not sortfield then
|
||||
local sortfield = fields.sortfield
|
||||
end
|
||||
if not sortdirection then
|
||||
local sortdirection = fields.sortdirection
|
||||
end
|
||||
|
||||
local messagesInbox = mail.sort_messages(messagesInboxFiltered, sortfield, sortdirection, filter)
|
||||
local messagesSent = mail.sort_messages(messagesOutboxFiltered, sortfield, sortdirection, filter)
|
||||
|
||||
|
|
11
ui/inbox.lua
11
ui/inbox.lua
|
@ -4,15 +4,12 @@ local S = minetest.get_translator("mail")
|
|||
|
||||
function mail.show_inbox(name, sortfield, sortdirection, filter)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
sortfield = 3
|
||||
sortfield = "3"
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
sortdirection = 1
|
||||
sortdirection = "1"
|
||||
end
|
||||
|
||||
sortfield = tostring(sortfield)
|
||||
sortdirection = tostring(sortdirection)
|
||||
|
||||
if not filter then
|
||||
filter = ""
|
||||
end
|
||||
|
@ -34,9 +31,9 @@ function mail.show_inbox(name, sortfield, sortdirection, filter)
|
|||
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
|
||||
|
||||
dropdown[0,9.4;2,0.5;sortfield;]] ..
|
||||
S("From") .. "," .. S("Subject") .. "," .. S("Date") .. [[;]] .. tostring(sortfield) .. [[;1]
|
||||
S("From") .. "," .. S("Subject") .. "," .. S("Date") .. [[;]] .. sortfield .. [[;true]
|
||||
dropdown[2.0,9.4;2,0.5;sortdirection;]] ..
|
||||
S("Ascending") .. "," .. S("Descending") .. [[;]] .. tostring(sortdirection) .. [[;1]
|
||||
S("Ascending") .. "," .. S("Descending") .. [[;]] .. sortdirection .. [[;true]
|
||||
field[4.25,9.85;1.4,0.5;filter;]] .. S("Filter") .. [[:;]] .. filter .. [[]
|
||||
button[5.14,9.52;0.85,0.5;search;Q]
|
||||
|
||||
|
|
|
@ -4,15 +4,12 @@ local S = minetest.get_translator("mail")
|
|||
|
||||
function mail.show_sent(name, sortfield, sortdirection, filter)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
sortfield = 3
|
||||
sortfield = "3"
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
sortdirection = 1
|
||||
sortdirection = "1"
|
||||
end
|
||||
|
||||
sortfield = tostring(sortfield)
|
||||
sortdirection = tostring(sortdirection)
|
||||
|
||||
if not filter then
|
||||
filter = ""
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue