liquid_feedback_frontend

changeset 829:36fa53881a8e

Improved unit editing
author bsw
date Tue Jul 10 23:37:08 2012 +0200 (2012-07-10)
parents 39ab80f1339c
children 9c714f697e4e
files app/main/admin/unit_list.lua
line diff
     1.1 --- a/app/main/admin/unit_list.lua	Tue Jul 10 23:19:38 2012 +0200
     1.2 +++ b/app/main/admin/unit_list.lua	Tue Jul 10 23:37:08 2012 +0200
     1.3 @@ -1,4 +1,6 @@
     1.4 -local units = Unit:get_flattened_tree{ active = true }
     1.5 +local inactive = param.get("inactive", atom.boolean)
     1.6 +
     1.7 +local units = Unit:get_flattened_tree{ include_inactive = inactive }
     1.8  
     1.9  ui.title(_"Unit list")
    1.10  
    1.11 @@ -8,22 +10,41 @@
    1.12      module = "admin",
    1.13      view = "unit_edit"
    1.14    }
    1.15 +  slot.put(" · ")
    1.16 +  if inactive then
    1.17 +    ui.link{
    1.18 +      text = _"Hide active units",
    1.19 +      module = "admin",
    1.20 +      view = "unit_list"
    1.21 +    }
    1.22 +  else
    1.23 +    ui.link{
    1.24 +      text = _"Show inactive units",
    1.25 +      module = "admin",
    1.26 +      view = "unit_list",
    1.27 +      params = { inactive = true }
    1.28 +    }
    1.29 +  end
    1.30  end)
    1.31   
    1.32  ui.list{
    1.33    records = units,
    1.34    columns = {
    1.35      {
    1.36 -      label = "name",
    1.37 -      name = "name"
    1.38 -    },
    1.39 -    {
    1.40        content = function(unit)
    1.41 +        for i = 1, unit.depth - 1 do
    1.42 +          slot.put("     ")
    1.43 +        end
    1.44 +        local style = ""
    1.45 +        if not unit.active then
    1.46 +          style = "text-decoration: line-through;"
    1.47 +        end
    1.48          ui.link{
    1.49 -          text = _"Edit unit",
    1.50 +          attr = { style = "font-weight: bold;" .. style },
    1.51 +          text = unit.name,
    1.52            module = "admin", view = "unit_edit", id = unit.id
    1.53          }
    1.54 -        slot.put(" ")
    1.55 +        slot.put(" · ")
    1.56          ui.link{
    1.57            text = _"Edit areas",
    1.58            module = "admin", view = "area_list", params = { unit_id = unit.id }

Impressum / About Us