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