| 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@1475
 | 
     7 ui.titleAdmin()
 | 
| 
bsw@1475
 | 
     8 
 | 
| 
bsw@1446
 | 
     9 ui.grid{ content = function()
 | 
| 
bsw@1248
 | 
    10 
 | 
| 
bsw@1446
 | 
    11   ui.cell_main{ content = function()
 | 
| 
bsw@1449
 | 
    12     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1449
 | 
    13       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1449
 | 
    14         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Organizational units and subject areas" }
 | 
| 
bsw@1451
 | 
    15       end }
 | 
| 
bsw@1451
 | 
    16       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1007
 | 
    17 
 | 
| 
bsw@1451
 | 
    18         for i_unit, unit in ipairs(units) do
 | 
| 
bsw@1451
 | 
    19           ui.container { 
 | 
| 
bsw@1451
 | 
    20             attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" },
 | 
| 
bsw@1451
 | 
    21             content = function ()
 | 
| 
bsw@1451
 | 
    22               ui.heading { level = 1, content = function ()
 | 
| 
bsw@1451
 | 
    23                 local class
 | 
| 
bsw@1451
 | 
    24                 if unit.active == false then
 | 
| 
bsw@1451
 | 
    25                   class = "inactive"
 | 
| 
bsw@1451
 | 
    26                 end
 | 
| 
bsw@1451
 | 
    27                 ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id }
 | 
| 
bsw@1451
 | 
    28               end }
 | 
| 
bsw@1451
 | 
    29               ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1451
 | 
    30                 local areas
 | 
| 
bsw@1451
 | 
    31                 if not inactive then
 | 
| 
bsw@1451
 | 
    32                   areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec()
 | 
| 
bsw@1451
 | 
    33                 else
 | 
| 
bsw@1451
 | 
    34                   areas = unit:get_reference_selector("areas"):add_order_by("name"):exec()
 | 
| 
bsw@1451
 | 
    35                 end
 | 
| 
bsw@1451
 | 
    36                 for i, area in ipairs(areas) do
 | 
| 
bsw@1451
 | 
    37                   ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1451
 | 
    38                     local class
 | 
| 
bsw@1451
 | 
    39                     if area.active == false then
 | 
| 
bsw@1451
 | 
    40                       class = "inactive"
 | 
| 
bsw@1451
 | 
    41                     end
 | 
| 
bsw@1451
 | 
    42                     ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id }
 | 
| 
bsw@1451
 | 
    43                   end }
 | 
| 
bsw@1451
 | 
    44                 end
 | 
| 
bsw@1451
 | 
    45                 ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1451
 | 
    46                   ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" }
 | 
| 
bsw@1450
 | 
    47                 end }
 | 
| 
bsw@1451
 | 
    48                 slot.put("<br />")
 | 
| 
bsw@1451
 | 
    49               end }
 | 
| 
bsw@1451
 | 
    50             end
 | 
| 
bsw@1451
 | 
    51           }
 | 
| 
bsw@1451
 | 
    52         end
 | 
| 
bsw@1451
 | 
    53         
 | 
| 
bsw@1451
 | 
    54         slot.put("<br />")
 | 
| 
bsw@1451
 | 
    55         ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" }
 | 
| 
bsw@1451
 | 
    56         slot.put("<br />")
 | 
| 
bsw@1451
 | 
    57         slot.put("<br />")
 | 
| 
bsw@1451
 | 
    58         
 | 
| 
bsw@1451
 | 
    59         if (not inactive) then
 | 
| 
bsw@1451
 | 
    60           ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" }
 | 
| 
bsw@1451
 | 
    61         else
 | 
| 
bsw@1451
 | 
    62           ui.link { module = "admin", view = "index", content = _"Hide inactive" }
 | 
| 
bsw@1451
 | 
    63         end
 | 
| 
bsw@1451
 | 
    64     
 | 
| 
bsw@1449
 | 
    65       end }
 | 
| 
bsw@1449
 | 
    66     end }
 | 
| 
bsw@1446
 | 
    67   end }
 | 
| 
bsw@1446
 | 
    68   
 | 
| 
bsw@1446
 | 
    69   ui.cell_sidebar{ content = function()
 | 
| 
bsw@1446
 | 
    70 
 | 
| 
bsw@1447
 | 
    71     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1447
 | 
    72       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1447
 | 
    73         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Members" }
 | 
| 
bsw@1446
 | 
    74       end }
 | 
| 
bsw@1447
 | 
    75       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1447
 | 
    76         ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1446
 | 
    77           ui.tag { tag = "li", content = function()
 | 
| 
bsw@1447
 | 
    78             ui.form{
 | 
| 
bsw@1447
 | 
    79               module = "admin", view = "member_list",
 | 
| 
bsw@1447
 | 
    80               content = function()
 | 
| 
bsw@1447
 | 
    81               
 | 
| 
bsw@1454
 | 
    82                 ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"search", name = "search" }
 | 
| 
bsw@1447
 | 
    83                 
 | 
| 
bsw@1447
 | 
    84                 ui.submit{ value = _"search" }
 | 
| 
bsw@1447
 | 
    85               
 | 
| 
bsw@1447
 | 
    86               end
 | 
| 
bsw@1446
 | 
    87             }
 | 
| 
bsw@1446
 | 
    88           end }
 | 
| 
bsw@1447
 | 
    89         end }
 | 
| 
bsw@1447
 | 
    90         ui.sidebarSection( "moreLink", function()
 | 
| 
bsw@1447
 | 
    91           ui.link{
 | 
| 
bsw@1447
 | 
    92             text = _"Register new member",
 | 
| 
bsw@1447
 | 
    93             module = "admin",
 | 
| 
bsw@1447
 | 
    94             view = "member_edit"
 | 
| 
bsw@1447
 | 
    95           }
 | 
| 
bsw@1447
 | 
    96         end )
 | 
| 
bsw@1446
 | 
    97       end }
 | 
| 
bsw@1447
 | 
    98     end }
 | 
| 
bsw@1447
 | 
    99 
 | 
| 
bsw@1447
 | 
   100     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1447
 | 
   101       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1448
 | 
   102         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Policies" }
 | 
| 
bsw@1448
 | 
   103       end }
 | 
| 
bsw@1448
 | 
   104       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1448
 | 
   105         ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
 | 
| 
bsw@1448
 | 
   106           for i, policy in ipairs(policies) do
 | 
| 
bsw@1448
 | 
   107             ui.tag { tag = "li", content = function()
 | 
| 
bsw@1448
 | 
   108               ui.link{
 | 
| 
bsw@1448
 | 
   109                 content = policy.name,
 | 
| 
bsw@1448
 | 
   110                 module = "admin",
 | 
| 
bsw@1448
 | 
   111                 view = "policy_show",
 | 
| 
bsw@1448
 | 
   112                 id = policy.id
 | 
| 
bsw@1448
 | 
   113               }
 | 
| 
bsw@1448
 | 
   114             end }
 | 
| 
bsw@1448
 | 
   115           end
 | 
| 
bsw@1448
 | 
   116         end }
 | 
| 
bsw@1448
 | 
   117 
 | 
| 
bsw@1448
 | 
   118         ui.link{
 | 
| 
bsw@1448
 | 
   119           text = _"Create new policy",
 | 
| 
bsw@1448
 | 
   120           module = "admin",
 | 
| 
bsw@1448
 | 
   121           view = "policy_show"
 | 
| 
bsw@1448
 | 
   122         }
 | 
| 
bsw@1448
 | 
   123         slot.put("   ")
 | 
| 
bsw@1448
 | 
   124         ui.link{
 | 
| 
bsw@1448
 | 
   125           text = _"Show policies not in use",
 | 
| 
bsw@1448
 | 
   126           module = "admin",
 | 
| 
bsw@1448
 | 
   127           view = "policy_list",
 | 
| 
bsw@1448
 | 
   128           params = { show_not_in_use = true }
 | 
| 
bsw@1448
 | 
   129         }
 | 
| 
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 
 |