Ver Fonte

Added refresh button to Minetest dashboards

Nathan Schneider há 2 anos atrás
pai
commit
046fad7f57
2 ficheiros alterados com 10 adições e 7 exclusões
  1. 1 1
      modpol_core/orgs/base.lua
  2. 9 6
      modpol_minetest/overrides/interactions.lua

+ 1 - 1
modpol_core/orgs/base.lua

@@ -175,7 +175,7 @@ function modpol.orgs:add_org(name, user)
     child_org.name = name
     child_org.parent = self.id
     child_org.processes = {}
-    child_org.modules = self.modules
+    child_org.modules = modpol.copy_table(self.modules)
     
     setmetatable(child_org, modpol.orgs)
 

+ 9 - 6
modpol_minetest/overrides/interactions.lua

@@ -51,7 +51,7 @@ function modpol.interactions.dashboard(user)
    -- set up formspec
     local formspec = {
        "formspec_version[4]",
-       "size[10,6]",
+       "size[10,8]",
        "label[0.5,0.5;M O D U L A R   P O L I T I C S]",
        "label[0.5,2;All orgs:]",
        "dropdown[2,1.5;7,0.8;all_orgs;"..formspec_list(all_orgs)..";;]",
@@ -59,7 +59,8 @@ function modpol.interactions.dashboard(user)
        "dropdown[2,2.5;7,0.8;user_orgs;"..formspec_list(user_orgs)..";;]",
        "label[0.5,4;All users:]",
        "dropdown[2,3.5;7,0.8;all_users;"..formspec_list(all_users)..";;]",
-       "button_exit[8.5,5;1,0.8;close;Close]",
+       "button[0.5,7;1,0.8;refresh;Refresh]",
+       "button_exit[8.5,7;1,0.8;close;Close]",
     }
     local formspec_string = table.concat(formspec, "")
     -- present to player
@@ -70,12 +71,11 @@ minetest.register_on_player_receive_fields(function (player, formname, fields)
       if formname == "modpol:dashboard" then
          local pname = player:get_player_name()
          if nil then
-            -- buttons first
-            -- none here right now!
-            
-         -- Put all dropdowns at the end
          elseif fields.close then
             minetest.close_formspec(pname, formname)
+         elseif fields.refresh then
+            modpol.interactions.dashboard(pname)
+         -- Put all dropdowns at the end
          elseif fields.all_orgs or fields.user_orgs then
             local org_name = fields.all_orgs or fields.user_orgs
             modpol.interactions.org_dashboard(pname, org_name)
@@ -163,6 +163,7 @@ function modpol.interactions.org_dashboard(user, org_string)
        "dropdown[2,3.5;7,0.8;modules;"..formspec_list(modules)..";;]",
        "label[0.5,5;Pending ("..num_pending.."):]",
        "dropdown[2,4.5;7,0.8;pending;"..formspec_list(pending)..";;]",
+       "button[0.5,7;1,0.8;refresh;Refresh]",
        "button[8.5,7;1,0.8;back;Back]",
     }
     local formspec_string = table.concat(formspec, "")
@@ -183,6 +184,8 @@ minetest.register_on_player_receive_fields(function (player, formname, fields)
          if nil then
          elseif fields.back then
             modpol.interactions.dashboard(pname)
+         elseif fields.refresh then
+            modpol.interactions.org_dashboard(pname,org.name)
             
          -- Put all dropdowns at the end
          -- Receiving modules