liquid_feedback_frontend

annotate app/main/admin/index.lua @ 1449:f27790f617c9

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

Impressum / About Us