Set up dropdowns in dashboard
This commit is contained in:
@@ -38,6 +38,21 @@ function modpol.orgs.list_all()
|
||||
return org_table
|
||||
end
|
||||
|
||||
-- Function: modpol.orgs.user_orgs(user)
|
||||
-- input: user (string)
|
||||
-- output: table of strings of org names
|
||||
function modpol.orgs.user_orgs(user)
|
||||
local all_orgs = modpol.orgs.list_all()
|
||||
local user_orgs = {}
|
||||
for i,v in ipairs(all_orgs) do
|
||||
local this_table = modpol.orgs.get_org(v)
|
||||
if this_table:has_member(user) then
|
||||
table.insert(user_orgs,v)
|
||||
end
|
||||
end
|
||||
return user_orgs
|
||||
end
|
||||
|
||||
-- ===========================================
|
||||
-- deletes all orgs except for the instance
|
||||
function modpol.orgs.reset()
|
||||
@@ -188,7 +203,7 @@ end
|
||||
-- adds a user to an org
|
||||
function modpol.orgs:add_member(user)
|
||||
-- trys to fill in empty spots first
|
||||
empty_index = self:get_member_index('')
|
||||
local empty_index = self:get_member_index('')
|
||||
if empty_index then
|
||||
self.members[empty_index] = user
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user