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