bsw@1184: local inactive = param.get("inactive", atom.boolean) bsw@1184: bsw@1184: local units = Unit:get_flattened_tree{ include_inactive = inactive } bsw@1184: bsw@1045: local policies = Policy:build_selector{}:add_order_by("index"):exec() bsw@1045: bsw@1446: ui.grid{ content = function() bsw@1248: bsw@1446: ui.cell_main{ content = function() bsw@1045: bsw@1045: ui.heading { level = 1, content = _"Organizational units and subject areas" } bsw@1007: bsw@1045: for i_unit, unit in ipairs(units) do bsw@1045: ui.container { bsw@1045: attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" }, bsw@1045: content = function () bsw@1045: ui.heading { level = 1, content = function () bsw@1184: local class bsw@1184: if unit.active == false then bsw@1184: class = "inactive" bsw@1184: end bsw@1184: ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id } bsw@1045: end } bsw@1045: ui.tag { tag = "ul", attr = { class = "ul" }, content = function () bsw@1184: local areas bsw@1184: if not inactive then bsw@1184: areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec() bsw@1184: else bsw@1184: areas = unit:get_reference_selector("areas"):add_order_by("name"):exec() bsw@1184: end bsw@1184: for i, area in ipairs(areas) do bsw@1045: ui.tag { tag = "li", content = function () bsw@1184: local class bsw@1184: if area.active == false then bsw@1184: class = "inactive" bsw@1184: end bsw@1184: ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id } bsw@1045: end } bsw@1045: end bsw@1045: ui.tag { tag = "li", content = function () bsw@1045: ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" } bsw@1045: end } bsw@1045: slot.put("
") bsw@1045: end } bsw@1045: end bsw@1045: } bsw@1045: end bsw@1045: bsw@1045: slot.put("
") bsw@1185: ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" } bsw@1184: slot.put("
") bsw@1184: slot.put("
") bsw@1184: bsw@1184: if (not inactive) then bsw@1184: ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" } bsw@1184: else bsw@1184: ui.link { module = "admin", view = "index", content = _"Hide inactive" } bsw@1184: end bsw@1045: bsw@1446: end } bsw@1446: bsw@1446: ui.cell_sidebar{ content = function() bsw@1446: bsw@1447: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1447: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1447: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Members" } bsw@1446: end } bsw@1447: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1447: ui.tag { tag = "ul", attr = { class = "ul" }, content = function() bsw@1446: ui.tag { tag = "li", content = function() bsw@1447: ui.form{ bsw@1447: module = "admin", view = "member_list", bsw@1447: content = function() bsw@1447: bsw@1447: ui.field.text{ label = _"search", name = "search" } bsw@1447: bsw@1447: ui.submit{ value = _"search" } bsw@1447: bsw@1447: end bsw@1446: } bsw@1446: end } bsw@1447: end } bsw@1447: ui.sidebarSection( "moreLink", function() bsw@1447: ui.link{ bsw@1447: text = _"Register new member", bsw@1447: module = "admin", bsw@1447: view = "member_edit" bsw@1447: } bsw@1447: end ) bsw@1446: end } bsw@1447: end } bsw@1447: bsw@1447: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1447: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1448: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Policies" } bsw@1448: end } bsw@1448: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1448: ui.tag { tag = "ul", attr = { class = "ul" }, content = function() bsw@1448: for i, policy in ipairs(policies) do bsw@1448: ui.tag { tag = "li", content = function() bsw@1448: ui.link{ bsw@1448: content = policy.name, bsw@1448: module = "admin", bsw@1448: view = "policy_show", bsw@1448: id = policy.id bsw@1448: } bsw@1448: end } bsw@1448: end bsw@1448: end } bsw@1448: bsw@1448: ui.link{ bsw@1448: text = _"Create new policy", bsw@1448: module = "admin", bsw@1448: view = "policy_show" bsw@1448: } bsw@1448: slot.put("   ") bsw@1448: ui.link{ bsw@1448: text = _"Show policies not in use", bsw@1448: module = "admin", bsw@1448: view = "policy_list", bsw@1448: params = { show_not_in_use = true } bsw@1448: } bsw@1448: end } bsw@1448: end } bsw@1448: bsw@1448: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1448: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1447: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Newsletter" } bsw@1447: end } bsw@1447: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1447: ui.link{ bsw@1447: text = _"Create a newsletter", bsw@1447: module = "admin", bsw@1447: view = "newsletter_edit" bsw@1447: } bsw@1448: slot.put("   ") bsw@1447: ui.link{ bsw@1447: text = _"Manage newsletters", bsw@1447: module = "admin", bsw@1447: view = "newsletter_list" bsw@1447: } bsw@1447: end } bsw@1447: end } bsw@1446: bsw@1447: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1447: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1447: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Cancel issue" } bsw@1447: end } bsw@1447: ui.container{ attr = { class = "mdl-card__content" }, content = function() bsw@1447: ui.form{ bsw@1447: module = "admin", bsw@1447: view = "cancel_issue", bsw@1447: content = function() bsw@1447: ui.tag { tag = "ul", attr = { class = "ul" }, content = function() bsw@1447: ui.tag { tag = "li", content = function() bsw@1447: ui.field.text{ label = _"Issue #", name = "id" } bsw@1447: ui.submit{ text = _"cancel issue" } bsw@1447: end } bsw@1447: end } bsw@1447: end bsw@1447: } bsw@1447: end } bsw@1447: end } bsw@1446: bsw@1446: end } bsw@1446: end } bsw@1446: bsw@1446: