# HG changeset patch # User bsw # Date 1340570283 -7200 # Node ID 5dc5f923797b6dede41eea5dd5cb1033ea4f1f6f # Parent 9df26b41ace04a628f824fc348ad0144b93704d7 Show link to unit in unit delegation entries in delegation list diff -r 9df26b41ace0 -r 5dc5f923797b app/main/delegation/_list.lua --- a/app/main/delegation/_list.lua Sun Jun 24 22:30:29 2012 +0200 +++ b/app/main/delegation/_list.lua Sun Jun 24 22:38:03 2012 +0200 @@ -7,13 +7,21 @@ attr = { class = "delegation_scope" }, content = function() local area + local unit if delegation.issue then area = delegation.issue.area + elseif delegation.area then + area = delegation.area else - area = delegation.area + unit = delegation.unit end - if not area then - ui.field.text{ value = _"Unit delegation" } + if unit then + ui.link{ + content = _"Unit '#{name}'":gsub("#{name}", unit.name), + module = "unit", + view = "show", + id = unit.id + } end if area then ui.link{ diff -r 9df26b41ace0 -r 5dc5f923797b model/delegation.lua --- a/model/delegation.lua Sun Jun 24 22:30:29 2012 +0200 +++ b/model/delegation.lua Sun Jun 24 22:38:03 2012 +0200 @@ -19,6 +19,14 @@ Delegation:add_reference{ mode = 'm1', + to = "Unit", + this_key = 'unit_id', + that_key = 'id', + ref = 'unit', +} + +Delegation:add_reference{ + mode = 'm1', to = "Area", this_key = 'area_id', that_key = 'id',