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