Adding and fixing basic modules for renaming, removing, and adding orgs

This commit is contained in:
Nathan Schneider
2021-12-19 16:00:26 -07:00
parent d4599e9bbe
commit 53d2a25f42
15 changed files with 371 additions and 130 deletions

View File

@ -1,20 +1,22 @@
--- module_template
-- @module module_template
--- change_modules
-- @module change_modules
--- (Required): data table containing name and description of the module
-- @field name "Human-readable name"
-- @field slug "Same as module class name"
-- @field desc "Description of the module"
local module_template = {
-- @field hide "Whether this is a hidden utility module"
local change_modules = {
name = "Module Human-Readable Name",
slug = "template",
desc = "Description of the module"
desc = "Description of the module",
hide = false;
}
--- (Required) Data for module
-- Variables that module uses during the course of a process
-- Can be blank
module_template.data = {
change_modules.data = {
}
--- (Required): config for module
@ -25,7 +27,7 @@ module_template.data = {
-- Default values set in config can be overridden
-- @field field_1 ex: votes_required, default = 5
-- @field field_2 ex: voting_type, default = "majority"
module_template.config = {
change_modules.config = {
field_1 = 5
field_2 = "majority"
}
@ -37,12 +39,16 @@ module_template.config = {
-- <li><code>self.id</code> (the process id of the module instance)</li>
-- @param result (optional) Callback if this module is embedded in other modules
-- @function initiate
function module_template:initiate(result)
-- call interaction functions here!
function change_modules:initiate(result)
-- call interaction functions here!
-- call result function
if result then result() end
-- concluding functions:
-- call these wherever process might end;
-- may need to put result in self.data.result
-- if process ends in another function
if result then result() end
self.org:delete_process(self.id)
end
--- (Required) Add to module table
modpol.modules.module_template = module_template
modpol.modules.change_modules = change_modules