added save button to edit options dialog (not yet functional)

This commit is contained in:
Sokomine 2021-06-25 19:12:58 +02:00
parent 6ad92fb198
commit e4a7bdc233

View File

@ -36,6 +36,12 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields)
return
end
if(fields.save_option) then
yl_speak_up.show_fs(player, "edit_option_dialog",
{n_id = n_id, d_id = d_id, o_id = o_id, caller="save_option"})
return
end
-- back to the main dialog window?
-- (this also happens when the last option was deleted)
if(fields.show_current_dialog or fields.quit or fields.button_exit or not(d_option) or fields.del_option) then
@ -252,13 +258,13 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
for i, o in ipairs(sorted_list) do
if(o == o_id and sorted_list[ i-1 ]) then
button_prev = ""..
"button[7.4,18.7;2.0,0.9;edit_option_prev;Prev]"..
"button[7.9,18.7;2.0,0.9;edit_option_prev;Prev]"..
"tooltip[edit_option_prev;Go to previous option/answer "..
"(according to o_sort).]"
end
if(o == o_id and sorted_list[ i+1 ]) then
button_next = ""..
"button[12.0,18.7;2.0,0.9;edit_option_next;Next]"..
"button[12.5,18.7;2.0,0.9;edit_option_next;Next]"..
"tooltip[edit_option_next;Go to next option/answer "..
"(according to o_sort).]"
end
@ -357,6 +363,9 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
"tooltip[del_option;Delete this option/answer.]"..
-- button: add new
button_add..
-- button: save
"button[4.6,18.7;2.0,0.9;save_option;Save]"..
"tooltip[save_option;Save what you canged (or discard it).]"..
-- button: prev/next
button_prev..
button_next..
@ -366,8 +375,8 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id)
"tooltip[show_current_dialog;Go back to dialog "..
minetest.formspec_escape(d_id).." and continue editing that dialog.]"..
-- allow to enter o_sort
"label[9.6,19.2;Sort:]"..
"field[10.6,18.7;1.0,0.9;edit_option_o_sort;;"..
"label[10.1,19.2;Sort:]"..
"field[11.1,18.7;1.0,0.9;edit_option_o_sort;;"..
minetest.formspec_escape(d_option.o_sort).."]"..
"tooltip[edit_option_o_sort;o_sort: The lower the number, the higher up in the "..
"list this option goes\nNegative values are ignored;#FFFFFF;#000000]"..