# HG changeset patch # User bsw # Date 1328635938 -3600 # Node ID 1b8d51e2161461ea7d1fdd9f9898e0da55be122e # Parent f42d16567c5d21a48249037db7c17a8b417316ee More unit support added diff -r f42d16567c5d -r 1b8d51e21614 app/main/_filter_view/30_navigation.lua --- a/app/main/_filter_view/30_navigation.lua Tue Feb 07 18:13:00 2012 +0100 +++ b/app/main/_filter_view/30_navigation.lua Tue Feb 07 18:32:18 2012 +0100 @@ -13,7 +13,7 @@ if app.session.member or config.public_access then - if config.feature_units_enabled then + if not config.single_unit_id then ui.link{ image = { static = "icons/16/package.png" }, text = _"Units", diff -r f42d16567c5d -r 1b8d51e21614 app/main/area/list.lua --- a/app/main/area/list.lua Tue Feb 07 18:13:00 2012 +0100 +++ b/app/main/area/list.lua Tue Feb 07 18:32:18 2012 +0100 @@ -1,11 +1,11 @@ -local unit_id = param.get("unit_id", atom.integer) +local unit_id = config.single_unit_id or param.get("unit_id", atom.integer) local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } local unit = Unit:by_id(unit_id) -if config.feature_units_enabled then +if not config.single_unit_id then slot.put_into("title", unit.name) else slot.put_into("title", encode.html(config.app_title)) diff -r f42d16567c5d -r 1b8d51e21614 app/main/delegation/_show_box.lua --- a/app/main/delegation/_show_box.lua Tue Feb 07 18:13:00 2012 +0100 +++ b/app/main/delegation/_show_box.lua Tue Feb 07 18:32:18 2012 +0100 @@ -3,10 +3,10 @@ local text if scope == "unit" and delegation and delegation.unit_id then image = { static = "icons/16/table_go.png" } - text = _"Change unit delegation" + text = config.single_unit_id and _"Change global delegation" or _"Change unit delegation" elseif scope == "unit" and not (delegation and delegation.unit_id) then image = { static = "icons/16/table_go.png" } - text = _"Set unit delegation" + text = config.single_unit_id and _"Set global delegation" or _"Set unit delegation" elseif scope == "area" and delegation and delegation.area_id then image = { static = "icons/16/table_go.png" } text = _"Change area delegation" @@ -136,7 +136,11 @@ elseif delegation.area_id then slot.put( _("Area delegated to '#{name}'", { name = member.delegation_name }) ) else - slot.put( _("Unit delegated to '#{name}'", { name = member.delegation_name }) ) + if config.single_unit_id then + slot.put( _("Global delegation set to '#{name}'", { name = member.delegation_name }) ) + else + slot.put( _("Unit delegated to '#{name}'", { name = member.delegation_name }) ) + end end else @@ -200,7 +204,7 @@ attr = { class = "delegation_scope" .. (overridden and " delegation_scope_overridden" or "") }, content = function() if record.scope_in == "unit" then - slot.put(_"Unit delegation") + slot.put(config.single_object_mode and _"Global delegation" or _"Unit delegation") elseif record.scope_in == "area" then slot.put(_"Area delegation") elseif record.scope_in == "issue" then diff -r f42d16567c5d -r 1b8d51e21614 app/main/delegation/new.lua --- a/app/main/delegation/new.lua Tue Feb 07 18:13:00 2012 +0100 +++ b/app/main/delegation/new.lua Tue Feb 07 18:32:18 2012 +0100 @@ -1,6 +1,6 @@ local unit = Unit:by_id(param.get("unit_id", atom.integer)) if unit then - slot.put_into("title", encode.html(_"Set unit delegation")) + slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) util.help("delegation.new.unit") end @@ -88,19 +88,21 @@ local unit_delegation = Delegation:by_pk(app.session.member_id, issue.area.unit_id) if unit_delegation then delegate_name = unit_delegation.trustee.name - scope = _"unit" + scope = config.single_unit_id and _"global" or _"unit" end end + local text_apply + local text_abandon + if config.single_unit_id then + text_apply = _("Apply global or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) + text_abandon = _"Abandon unit and area delegations for this issue" + else + text_apply = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) + text_abandon = _"Abandon unit and area delegations for this issue" + end records = { - { - id = -1, - name = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) - }, - { - id = 0, - name = _"Abandon unit and area delegations for this issue" - }, - + { id = -1, name = text_apply }, + { id = 0, name = text_abandom } } elseif area then local delegate_name = "" @@ -108,16 +110,25 @@ local unit_delegation = Delegation:by_pk(app.session.member_id, area.unit_id) if unit_delegation then delegate_name = unit_delegation.trustee.name - scope = _"unit" + scope = config.single_unit_id and _"global" or _"unit" + end + local text_apply + local text_abandon + if config.single_unit_id then + text_apply = _("Apply global delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) + text_abandon = _"Abandon global delegation for this area" + else + text_apply = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) + text_abandon = _"Abandon unit delegation for this area" end records = { { id = -1, - name = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) + name = text_apply }, { id = 0, - name = _"Abandon unit delegation for this area" + name = text_abandon } } diff -r f42d16567c5d -r 1b8d51e21614 model/area.lua --- a/model/area.lua Tue Feb 07 18:13:00 2012 +0100 +++ b/model/area.lua Tue Feb 07 18:32:18 2012 +0100 @@ -78,7 +78,9 @@ end function Area.object_get:name_with_unit_name() - if config.feature_units_enabled then + if not config.single_unit_id then return self.unit.name .. " > " .. self.name + else + return self.name end end \ No newline at end of file