liquid_feedback_frontend

annotate app/main/admin/index.lua @ 1446:b86558a65a20

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

Impressum / About Us