mirror of
https://github.com/mt-mods/mail.git
synced 2025-03-15 06:01:25 +00:00
Move contributor_grouping to selected_idxs
This commit is contained in:
parent
3670fe79cc
commit
c6d8543c85
2 changed files with 11 additions and 7 deletions
1
init.lua
1
init.lua
|
@ -30,6 +30,7 @@ mail = {
|
||||||
multipleselection = {},
|
multipleselection = {},
|
||||||
optionstab = {},
|
optionstab = {},
|
||||||
settings_group = {},
|
settings_group = {},
|
||||||
|
contributor_grouping = {},
|
||||||
},
|
},
|
||||||
|
|
||||||
message_drafts = {}
|
message_drafts = {}
|
||||||
|
|
17
ui/about.lua
17
ui/about.lua
|
@ -43,8 +43,8 @@ local contributors = {
|
||||||
{ name = "y5nw", groups = {"c", "i"} },
|
{ name = "y5nw", groups = {"c", "i"} },
|
||||||
}
|
}
|
||||||
|
|
||||||
function mail.show_about(name, contributor_grouping)
|
function mail.show_about(name)
|
||||||
contributor_grouping = tonumber(contributor_grouping) or 1
|
mail.selected_idxs.contributor_grouping[name] = tonumber(mail.selected_idxs.contributor_grouping[name]) or 1
|
||||||
|
|
||||||
local formspec = [[
|
local formspec = [[
|
||||||
size[10,6;]
|
size[10,6;]
|
||||||
|
@ -71,14 +71,16 @@ function mail.show_about(name, contributor_grouping)
|
||||||
button[2,5.7;2,0.5;contentdb;ContentDB]
|
button[2,5.7;2,0.5;contentdb;ContentDB]
|
||||||
|
|
||||||
box[4,0;3,0.45;]] .. mail.get_color("highlighted") .. [[]
|
box[4,0;3,0.45;]] .. mail.get_color("highlighted") .. [[]
|
||||||
label[4.2,0;]] .. S("Contributors") .. "]" ..
|
label[4.2,0;]] .. S("Contributors") .. [[]
|
||||||
|
|
||||||
("dropdown[4,0.75;6.4;contributor_grouping;%s,%s;%d;true]"):format(
|
dropdown[4,0.75;6.4;contributor_grouping;]]
|
||||||
S("Group by name"), S("Group by contribution"), contributor_grouping)
|
.. S("Group by name") .. ","
|
||||||
|
.. S("Group by contribution") .. ";" .. mail.selected_idxs.contributor_grouping[name] .. [[;true]
|
||||||
|
]]
|
||||||
|
|
||||||
local contributor_list, contributor_columns = {}
|
local contributor_list, contributor_columns = {}
|
||||||
|
|
||||||
if contributor_grouping == 2 then
|
if mail.selected_idxs.contributor_grouping[name] == 2 then
|
||||||
contributor_columns = "color;text"
|
contributor_columns = "color;text"
|
||||||
local sorted = {}
|
local sorted = {}
|
||||||
for _, g in ipairs(groups) do
|
for _, g in ipairs(groups) do
|
||||||
|
@ -144,6 +146,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
elseif fields.contentdb then
|
elseif fields.contentdb then
|
||||||
minetest.chat_send_player(playername, "https://content.minetest.net/packages/mt-mods/mail")
|
minetest.chat_send_player(playername, "https://content.minetest.net/packages/mt-mods/mail")
|
||||||
elseif fields.contributor_grouping then
|
elseif fields.contributor_grouping then
|
||||||
mail.show_about(playername, fields.contributor_grouping)
|
mail.selected_idxs.contributor_grouping[playername] = fields.contributor_grouping
|
||||||
|
mail.show_about(playername)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Reference in a new issue