liquid_feedback_frontend
changeset 264:1b8d51e21614
More unit support added
author | bsw |
---|---|
date | Tue Feb 07 18:32:18 2012 +0100 (2012-02-07) |
parents | f42d16567c5d |
children | d37dce888225 |
files | app/main/_filter_view/30_navigation.lua app/main/area/list.lua app/main/delegation/_show_box.lua app/main/delegation/new.lua model/area.lua |
line diff
1.1 --- a/app/main/_filter_view/30_navigation.lua Tue Feb 07 18:13:00 2012 +0100 1.2 +++ b/app/main/_filter_view/30_navigation.lua Tue Feb 07 18:32:18 2012 +0100 1.3 @@ -13,7 +13,7 @@ 1.4 1.5 if app.session.member or config.public_access then 1.6 1.7 - if config.feature_units_enabled then 1.8 + if not config.single_unit_id then 1.9 ui.link{ 1.10 image = { static = "icons/16/package.png" }, 1.11 text = _"Units",
2.1 --- a/app/main/area/list.lua Tue Feb 07 18:13:00 2012 +0100 2.2 +++ b/app/main/area/list.lua Tue Feb 07 18:32:18 2012 +0100 2.3 @@ -1,11 +1,11 @@ 2.4 -local unit_id = param.get("unit_id", atom.integer) 2.5 +local unit_id = config.single_unit_id or param.get("unit_id", atom.integer) 2.6 2.7 local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 2.8 2.9 local unit = Unit:by_id(unit_id) 2.10 2.11 2.12 -if config.feature_units_enabled then 2.13 +if not config.single_unit_id then 2.14 slot.put_into("title", unit.name) 2.15 else 2.16 slot.put_into("title", encode.html(config.app_title))
3.1 --- a/app/main/delegation/_show_box.lua Tue Feb 07 18:13:00 2012 +0100 3.2 +++ b/app/main/delegation/_show_box.lua Tue Feb 07 18:32:18 2012 +0100 3.3 @@ -3,10 +3,10 @@ 3.4 local text 3.5 if scope == "unit" and delegation and delegation.unit_id then 3.6 image = { static = "icons/16/table_go.png" } 3.7 - text = _"Change unit delegation" 3.8 + text = config.single_unit_id and _"Change global delegation" or _"Change unit delegation" 3.9 elseif scope == "unit" and not (delegation and delegation.unit_id) then 3.10 image = { static = "icons/16/table_go.png" } 3.11 - text = _"Set unit delegation" 3.12 + text = config.single_unit_id and _"Set global delegation" or _"Set unit delegation" 3.13 elseif scope == "area" and delegation and delegation.area_id then 3.14 image = { static = "icons/16/table_go.png" } 3.15 text = _"Change area delegation" 3.16 @@ -136,7 +136,11 @@ 3.17 elseif delegation.area_id then 3.18 slot.put( _("Area delegated to '#{name}'", { name = member.delegation_name }) ) 3.19 else 3.20 - slot.put( _("Unit delegated to '#{name}'", { name = member.delegation_name }) ) 3.21 + if config.single_unit_id then 3.22 + slot.put( _("Global delegation set to '#{name}'", { name = member.delegation_name }) ) 3.23 + else 3.24 + slot.put( _("Unit delegated to '#{name}'", { name = member.delegation_name }) ) 3.25 + end 3.26 end 3.27 3.28 else 3.29 @@ -200,7 +204,7 @@ 3.30 attr = { class = "delegation_scope" .. (overridden and " delegation_scope_overridden" or "") }, 3.31 content = function() 3.32 if record.scope_in == "unit" then 3.33 - slot.put(_"Unit delegation") 3.34 + slot.put(config.single_object_mode and _"Global delegation" or _"Unit delegation") 3.35 elseif record.scope_in == "area" then 3.36 slot.put(_"Area delegation") 3.37 elseif record.scope_in == "issue" then
4.1 --- a/app/main/delegation/new.lua Tue Feb 07 18:13:00 2012 +0100 4.2 +++ b/app/main/delegation/new.lua Tue Feb 07 18:32:18 2012 +0100 4.3 @@ -1,6 +1,6 @@ 4.4 local unit = Unit:by_id(param.get("unit_id", atom.integer)) 4.5 if unit then 4.6 - slot.put_into("title", encode.html(_"Set unit delegation")) 4.7 + slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) 4.8 util.help("delegation.new.unit") 4.9 end 4.10 4.11 @@ -88,19 +88,21 @@ 4.12 local unit_delegation = Delegation:by_pk(app.session.member_id, issue.area.unit_id) 4.13 if unit_delegation then 4.14 delegate_name = unit_delegation.trustee.name 4.15 - scope = _"unit" 4.16 + scope = config.single_unit_id and _"global" or _"unit" 4.17 end 4.18 end 4.19 + local text_apply 4.20 + local text_abandon 4.21 + if config.single_unit_id then 4.22 + text_apply = _("Apply global or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.23 + text_abandon = _"Abandon unit and area delegations for this issue" 4.24 + else 4.25 + text_apply = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.26 + text_abandon = _"Abandon unit and area delegations for this issue" 4.27 + end 4.28 records = { 4.29 - { 4.30 - id = -1, 4.31 - name = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.32 - }, 4.33 - { 4.34 - id = 0, 4.35 - name = _"Abandon unit and area delegations for this issue" 4.36 - }, 4.37 - 4.38 + { id = -1, name = text_apply }, 4.39 + { id = 0, name = text_abandom } 4.40 } 4.41 elseif area then 4.42 local delegate_name = "" 4.43 @@ -108,16 +110,25 @@ 4.44 local unit_delegation = Delegation:by_pk(app.session.member_id, area.unit_id) 4.45 if unit_delegation then 4.46 delegate_name = unit_delegation.trustee.name 4.47 - scope = _"unit" 4.48 + scope = config.single_unit_id and _"global" or _"unit" 4.49 + end 4.50 + local text_apply 4.51 + local text_abandon 4.52 + if config.single_unit_id then 4.53 + text_apply = _("Apply global delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.54 + text_abandon = _"Abandon global delegation for this area" 4.55 + else 4.56 + text_apply = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.57 + text_abandon = _"Abandon unit delegation for this area" 4.58 end 4.59 records = { 4.60 { 4.61 id = -1, 4.62 - name = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 4.63 + name = text_apply 4.64 }, 4.65 { 4.66 id = 0, 4.67 - name = _"Abandon unit delegation for this area" 4.68 + name = text_abandon 4.69 } 4.70 } 4.71
5.1 --- a/model/area.lua Tue Feb 07 18:13:00 2012 +0100 5.2 +++ b/model/area.lua Tue Feb 07 18:32:18 2012 +0100 5.3 @@ -78,7 +78,9 @@ 5.4 end 5.5 5.6 function Area.object_get:name_with_unit_name() 5.7 - if config.feature_units_enabled then 5.8 + if not config.single_unit_id then 5.9 return self.unit.name .. " > " .. self.name 5.10 + else 5.11 + return self.name 5.12 end 5.13 end 5.14 \ No newline at end of file