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