# HG changeset patch # User bsw # Date 1341956228 -7200 # Node ID 36fa53881a8ef45ec6be963ab00bf19c00ecd5f0 # Parent 39ab80f1339c862fea7c02e696369cb2d0b6d695 Improved unit editing diff -r 39ab80f1339c -r 36fa53881a8e app/main/admin/unit_list.lua --- a/app/main/admin/unit_list.lua Tue Jul 10 23:19:38 2012 +0200 +++ b/app/main/admin/unit_list.lua Tue Jul 10 23:37:08 2012 +0200 @@ -1,4 +1,6 @@ -local units = Unit:get_flattened_tree{ active = true } +local inactive = param.get("inactive", atom.boolean) + +local units = Unit:get_flattened_tree{ include_inactive = inactive } ui.title(_"Unit list") @@ -8,22 +10,41 @@ module = "admin", view = "unit_edit" } + slot.put(" · ") + if inactive then + ui.link{ + text = _"Hide active units", + module = "admin", + view = "unit_list" + } + else + ui.link{ + text = _"Show inactive units", + module = "admin", + view = "unit_list", + params = { inactive = true } + } + end end) ui.list{ records = units, columns = { { - label = "name", - name = "name" - }, - { content = function(unit) + for i = 1, unit.depth - 1 do + slot.put("     ") + end + local style = "" + if not unit.active then + style = "text-decoration: line-through;" + end ui.link{ - text = _"Edit unit", + attr = { style = "font-weight: bold;" .. style }, + text = unit.name, module = "admin", view = "unit_edit", id = unit.id } - slot.put(" ") + slot.put(" · ") ui.link{ text = _"Edit areas", module = "admin", view = "area_list", params = { unit_id = unit.id }