Fixes on creating and listing child orgs in formspec dashboards
This commit is contained in:
		| @@ -119,6 +119,11 @@ function modpol.interactions.org_dashboard(user, org_name) | ||||
|       end | ||||
|       return toggle_code | ||||
|    end | ||||
|    local children = {} | ||||
|    for k,v in ipairs(org.children) do | ||||
|       local this_child = modpol.orgs.get_org(v) | ||||
|       table.insert(children, this_child.name) | ||||
|    end | ||||
|    -- set player context | ||||
|    local user_context = {} | ||||
|    user_context["current_org"] = org_name | ||||
| @@ -134,13 +139,13 @@ function modpol.interactions.org_dashboard(user, org_name) | ||||
|        "label[0.5,2;Members:]", | ||||
|        "dropdown[2,1.5;5,0.8;user_orgs;"..formspec_list(org.members)..";;]", | ||||
|        "label[0.5,3;Children:]", | ||||
|        "dropdown[2,2.5;5,0.8;children;"..formspec_list(org.children)..";;]", | ||||
|        "dropdown[2,2.5;5,0.8;children;"..formspec_list(children)..";;]", | ||||
|        "label[0.5,4;Policies:]", | ||||
|        "dropdown[2,3.5;5,0.8;policies;"..formspec_list(org.policies)..";;]", | ||||
|        "label[0.5,5;Processes:]", | ||||
|        "dropdown[2,4.5;5,0.8;processes;"..formspec_list(org.processes)..";;]", | ||||
|        "button[0.5,7;1,0.8;test_poll;Test poll]", | ||||
|        "button[2,7;1,0.8;add_org;Add child]", | ||||
|        "button[2,7;1,0.8;add_child;Add child]", | ||||
|        "button[3.5,7;1.5,0.8;remove_org;Remove org]", | ||||
|        "button[8.5,7;1,0.8;back;Back]", | ||||
|     } | ||||
| @@ -162,8 +167,8 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) | ||||
|             modpol.interactions.dashboard(pname) | ||||
|          elseif fields.test_poll then | ||||
|             modpol.interactions.binary_poll_org(pname, _contexts.pname.current_org.id, "Poll question (yes/no):") | ||||
|          elseif fields.add_org then | ||||
|             modpol.interactions.add_org(pname, _contexts.pname.current_org.id) | ||||
|          elseif fields.add_child then | ||||
|             modpol.interactions.add_org(pname, org.id) | ||||
|          elseif fields.remove_org then | ||||
|             modpol.interactions.remove_org(pname) | ||||
|          elseif fields.back then | ||||
|   | ||||
		Reference in New Issue
	
	Block a user