liquid_feedback_frontend

annotate app/main/admin/index.lua @ 1835:8147173d9a13

Fixed layout of admin page
author bsw
date Thu Feb 03 12:43:18 2022 +0100 (2022-02-03)
parents 2a0d86117d54
children 1dad272c08eb
rev   line source
bsw@1184 1 local inactive = param.get("inactive", atom.boolean)
bsw@1835 2 local inactive_policies = param.get("inactive_policies", atom.boolean)
bsw@1835 3
bsw@1835 4
bsw@1184 5
bsw@1504 6 local units = Unit:get_flattened_tree{ include_inactive = inactive, include_hidden = true }
bsw@1184 7
bsw@1835 8 local policies = Policy:build_selector{ active = not inactive_policies }:exec()
bsw@1477 9 --local policies = Policy:build_selector{}:add_order_by("index"):exec()
bsw@1045 10
bsw@1475 11 ui.titleAdmin()
bsw@1475 12
bsw@1446 13 ui.grid{ content = function()
bsw@1248 14
bsw@1446 15 ui.cell_main{ content = function()
bsw@1449 16 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1449 17 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1449 18 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Organizational units and subject areas" }
bsw@1451 19 end }
bsw@1451 20 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1007 21
bsw@1451 22 for i_unit, unit in ipairs(units) do
bsw@1451 23 ui.container {
bsw@1451 24 attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" },
bsw@1451 25 content = function ()
bsw@1451 26 ui.heading { level = 1, content = function ()
bsw@1451 27 local class
bsw@1451 28 if unit.active == false then
bsw@1451 29 class = "inactive"
bsw@1451 30 end
bsw@1451 31 ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id }
bsw@1451 32 end }
bsw@1451 33 ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
bsw@1451 34 local areas
bsw@1451 35 if not inactive then
bsw@1451 36 areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec()
bsw@1451 37 else
bsw@1451 38 areas = unit:get_reference_selector("areas"):add_order_by("name"):exec()
bsw@1451 39 end
bsw@1451 40 for i, area in ipairs(areas) do
bsw@1451 41 ui.tag { tag = "li", content = function ()
bsw@1451 42 local class
bsw@1451 43 if area.active == false then
bsw@1451 44 class = "inactive"
bsw@1451 45 end
bsw@1451 46 ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id }
bsw@1451 47 end }
bsw@1451 48 end
bsw@1451 49 ui.tag { tag = "li", content = function ()
bsw@1451 50 ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" }
bsw@1450 51 end }
bsw@1451 52 slot.put("<br />")
bsw@1451 53 end }
bsw@1451 54 end
bsw@1451 55 }
bsw@1451 56 end
bsw@1835 57 end }
bsw@1835 58
bsw@1835 59 ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
bsw@1835 60 ui.link {
bsw@1835 61 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 62 module = "admin", view = "unit_edit", content = _"Create new unit"
bsw@1835 63 }
bsw@1451 64
bsw@1451 65 if (not inactive) then
bsw@1835 66 ui.link {
bsw@1835 67 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 68 module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive"
bsw@1835 69 }
bsw@1451 70 else
bsw@1835 71 ui.link {
bsw@1835 72 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 73 module = "admin", view = "index", content = _"Hide inactive"
bsw@1835 74 }
bsw@1451 75 end
bsw@1451 76
bsw@1449 77 end }
bsw@1449 78 end }
bsw@1446 79 end }
bsw@1446 80
bsw@1446 81 ui.cell_sidebar{ content = function()
bsw@1446 82
bsw@1447 83 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1447 84 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1447 85 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Members" }
bsw@1446 86 end }
bsw@1447 87 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1835 88 ui.form{
bsw@1835 89 module = "admin", view = "member_list",
bsw@1835 90 content = function()
bsw@1835 91 ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"search", name = "search" }
bsw@1835 92 slot.put(" ")
bsw@1835 93 ui.submit{ value = _"OK" }
bsw@1835 94 end
bsw@1835 95 }
bsw@1835 96 end }
bsw@1835 97
bsw@1835 98 ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
bsw@1835 99 ui.link{
bsw@1835 100 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 101 text = _"Add member",
bsw@1835 102 module = "admin",
bsw@1835 103 view = "member_edit"
bsw@1835 104 }
bsw@1446 105 end }
bsw@1447 106 end }
bsw@1447 107
bsw@1447 108 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1447 109 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1448 110 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Policies" }
bsw@1448 111 end }
bsw@1448 112 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1448 113 ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
bsw@1448 114 for i, policy in ipairs(policies) do
bsw@1448 115 ui.tag { tag = "li", content = function()
bsw@1448 116 ui.link{
bsw@1448 117 content = policy.name,
bsw@1448 118 module = "admin",
bsw@1448 119 view = "policy_show",
bsw@1448 120 id = policy.id
bsw@1448 121 }
bsw@1448 122 end }
bsw@1448 123 end
bsw@1448 124 end }
bsw@1835 125 end }
bsw@1448 126
bsw@1835 127 ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
bsw@1448 128 ui.link{
bsw@1835 129 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 130 text = _"Add policy",
bsw@1448 131 module = "admin",
bsw@1448 132 view = "policy_show"
bsw@1448 133 }
bsw@1448 134 slot.put(" &nbsp; ")
bsw@1835 135 if (not inactive_policies) then
bsw@1835 136 ui.link {
bsw@1835 137 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 138 module = "admin", view = "index", params = { inactive_policies = true }, content = _"Show inactive"
bsw@1835 139 }
bsw@1477 140 else
bsw@1835 141 ui.link {
bsw@1835 142 attr = { class = "mdl-button mdl-js-button" },
bsw@1835 143 module = "admin", view = "index", content = _"Hide inactive"
bsw@1835 144 }
bsw@1477 145 end
bsw@1448 146 end }
bsw@1448 147 end }
bsw@1448 148
bsw@1448 149 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1448 150 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1447 151 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Newsletter" }
bsw@1447 152 end }
bsw@1447 153 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1447 154 ui.link{
bsw@1447 155 text = _"Create a newsletter",
bsw@1447 156 module = "admin",
bsw@1447 157 view = "newsletter_edit"
bsw@1447 158 }
bsw@1448 159 slot.put(" &nbsp; ")
bsw@1447 160 ui.link{
bsw@1447 161 text = _"Manage newsletters",
bsw@1447 162 module = "admin",
bsw@1447 163 view = "newsletter_list"
bsw@1447 164 }
bsw@1447 165 end }
bsw@1447 166 end }
bsw@1446 167
bsw@1447 168 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1447 169 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1447 170 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Cancel issue" }
bsw@1447 171 end }
bsw@1447 172 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1447 173 ui.form{
bsw@1447 174 module = "admin",
bsw@1447 175 view = "cancel_issue",
bsw@1447 176 content = function()
bsw@1835 177 ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"Issue #", name = "id" }
bsw@1835 178 slot.put(" ")
bsw@1835 179 ui.submit{ text = _"OK" }
bsw@1447 180 end
bsw@1447 181 }
bsw@1447 182 end }
bsw@1447 183 end }
bsw@1446 184
bsw@1446 185 end }
bsw@1446 186 end }
bsw@1446 187
bsw@1446 188

Impressum / About Us