liquid_feedback_frontend
view app/main/admin/index.lua @ 1228:554b739f86d6
Removed developer settings
| author | bsw | 
|---|---|
| date | Tue Dec 01 17:43:16 2015 +0100 (2015-12-01) | 
| parents | fef745f9e22f | 
| children | c0fd12b97d65 | 
 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.titleAdmin()
     9 ui.sidebar( "tab-members", function()
    10   ui.sidebarHead( function()
    11     ui.heading { level = 2, content = _"Members" }
    12   end )
    14   ui.sidebarSection( function()
    15     ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
    16       ui.tag { tag = "li", content = function()
    17         ui.form{
    18           module = "admin", view = "member_list",
    19           content = function()
    21             ui.field.text{ label = _"search", name = "search" }
    23             ui.submit{ value = _"search" }
    25           end
    26         }
    27       end }
    28     end }
    29   end )
    30   ui.sidebarSection( "moreLink", function()
    31     ui.link{
    32       text = _"Register new member",
    33       module = "admin",
    34       view = "member_edit"
    35     }
    36   end )
    37 end )
    39 ui.sidebar( "tab-whatcanido", function()
    40   ui.sidebarHead( function()
    41     ui.heading { level = 2, content = _"Cancel issue" }
    42   end )
    44   ui.sidebarSection( function()
    45     ui.form{
    46       module = "admin",
    47       view = "cancel_issue",
    48       content = function()
    49         ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
    50           ui.tag { tag = "li", content = function()
    51             ui.field.text{ label = _"Issue #", name = "id" }
    52             ui.submit{ text = _"cancel issue" }
    53           end }
    54         end }
    55       end
    56     }
    57   end )
    58 end )
    60 ui.sidebar("tab-whatcanido", function()
    61   ui.sidebarHead( function()
    62     ui.heading { level = 2, content = _"Policies" }
    63   end )
    65   ui.sidebarSection( function()
    66     ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
    67       for i, policy in ipairs(policies) do
    68         ui.tag { tag = "li", content = function()
    69           ui.link{
    70             content = policy.name,
    71             module = "admin",
    72             view = "policy_show",
    73             id = policy.id
    74           }
    75         end }
    76       end
    77     end }
    78   end )
    79   ui.sidebarSection( "moreLink", function()
    80     ui.link{
    81       text = _"Create new policy",
    82       module = "admin",
    83       view = "policy_show"
    84     }
    85   end )
    86   ui.sidebarSection( "moreLink", function()
    87     ui.link{
    88       text = _"Show policies not in use",
    89       module = "admin",
    90       view = "policy_list",
    91       params = { show_not_in_use = true }
    92     }
    93   end )
    94 end )
    97 ui.section( function()
    98   ui.sectionHead( function()
    99     ui.heading { level = 1, content = _"Organizational units and subject areas" }
   100   end )
   101   ui.sectionRow( function()
   103     for i_unit, unit in ipairs(units) do
   104       ui.container { 
   105         attr = { style = "margin-left: " .. ((unit.depth - 1)* 2) .. "em;" },
   106         content = function ()
   107           ui.heading { level = 1, content = function ()
   108             local class
   109             if unit.active == false then
   110               class = "inactive"
   111             end
   112             ui.link{ attr = { class = class }, text = unit.name, module = "admin", view = "unit_edit", id = unit.id }
   113           end }
   114           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   115             local areas
   116             if not inactive then
   117               areas = unit:get_reference_selector("areas"):add_order_by("name"):add_where("active"):exec()
   118             else
   119               areas = unit:get_reference_selector("areas"):add_order_by("name"):exec()
   120             end
   121             for i, area in ipairs(areas) do
   122               ui.tag { tag = "li", content = function ()
   123                 local class
   124                 if area.active == false then
   125                   class = "inactive"
   126                 end
   127                 ui.link{ attr = { class = class }, text = area.name, module = "admin", view = "area_show", id = area.id }
   128               end }
   129             end
   130             ui.tag { tag = "li", content = function ()
   131               ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" }
   132             end }
   133             slot.put("<br />")
   134           end }
   135         end
   136       }
   137     end
   139     slot.put("<br />")
   140     ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" }
   141     slot.put("<br />")
   142     slot.put("<br />")
   144     if (not inactive) then
   145       ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" }
   146     else
   147       ui.link { module = "admin", view = "index", content = _"Hide inactive" }
   148     end
   150   end)
   151 end)
