liquid_feedback_frontend
diff app/main/delegation/_action/update.lua @ 217:73dbc9e2bfd4
Cummulative patch for enhancements at next generation frontend
| author | bsw | 
|---|---|
| date | Sat Mar 12 19:22:50 2011 +0100 (2011-03-12) | 
| parents | 02aacb3dffe0 | 
| children | 
   line diff
1.1 --- a/app/main/delegation/_action/update.lua Mon Mar 07 12:15:22 2011 +0100 1.2 +++ b/app/main/delegation/_action/update.lua Sat Mar 12 19:22:50 2011 +0100 1.3 @@ -2,15 +2,19 @@ 1.4 1.5 local trustee_id = param.get("trustee_id", atom.integer) 1.6 1.7 +local unit_id = param.get("unit_id", atom.integer) 1.8 + 1.9 local area_id = param.get("area_id", atom.integer) 1.10 1.11 local issue_id = param.get("issue_id", atom.integer) 1.12 1.13 if issue_id then 1.14 area_id = nil 1.15 +elseif area_id then 1.16 + unit_id = nil 1.17 end 1.18 1.19 -local delegation = Delegation:by_pk(truster_id, area_id, issue_id) 1.20 +local delegation = Delegation:by_pk(truster_id, unit_id, area_id, issue_id) 1.21 1.22 if param.get("delete") or trustee_id == -1 then 1.23 1.24 @@ -22,8 +26,10 @@ 1.25 slot.put_into("notice", _"Your delegation for this issue has been deleted.") 1.26 elseif area_id then 1.27 slot.put_into("notice", _"Your delegation for this area has been deleted.") 1.28 + elseif unit_id then 1.29 + slot.put_into("notice", _"Your delegation for this unit has been deleted.") 1.30 else 1.31 - slot.put_into("notice", _"Your global delegation has been deleted.") 1.32 + error("shouldn't happen") 1.33 end 1.34 1.35 end 1.36 @@ -33,14 +39,17 @@ 1.37 if not delegation then 1.38 delegation = Delegation:new() 1.39 delegation.truster_id = truster_id 1.40 + delegation.unit_id = unit_id 1.41 delegation.area_id = area_id 1.42 delegation.issue_id = issue_id 1.43 if issue_id then 1.44 delegation.scope = "issue" 1.45 elseif area_id then 1.46 delegation.scope = "area" 1.47 + elseif unit_id then 1.48 + delegation.scope = "unit" 1.49 else 1.50 - delegation.scope = "global" 1.51 + error("should'nt happen") 1.52 end 1.53 end 1.54 if trustee_id == 0 then 1.55 @@ -55,8 +64,10 @@ 1.56 slot.put_into("notice", _"Your delegation for this issue has been updated.") 1.57 elseif area_id then 1.58 slot.put_into("notice", _"Your delegation for this area has been updated.") 1.59 + elseif unit_id then 1.60 + slot.put_into("notice", _"Your delegation for this unit has been updated.") 1.61 else 1.62 - slot.put_into("notice", _"Your global delegation has been updated.") 1.63 + error("shouldn't happen") 1.64 end 1.65 1.66 end