liquid_feedback_frontend

view app/main/delegation/_action/update.lua @ 278:fecd4c13054a

Code/css clean up and minor enhancements
author bsw
date Mon Feb 13 01:53:41 2012 +0100 (2012-02-13)
parents e3613831cd1e
children b77e6a17ca77
line source
1 local truster_id = app.session.member.id
3 local trustee_id = param.get("trustee_id", atom.integer)
5 local unit_id = param.get("unit_id", atom.integer)
7 local area_id = param.get("area_id", atom.integer)
9 local issue_id = param.get("issue_id", atom.integer)
11 if issue_id then
12 area_id = nil
13 end
15 local delegation = Delegation:by_pk(truster_id, unit_id, area_id, issue_id)
17 if param.get("delete") or trustee_id == -1 then
19 if delegation then
21 delegation:destroy()
23 --[[
24 if issue_id then
25 slot.put_into("notice", _"Your delegation for this issue has been deleted.")
26 elseif area_id then
27 slot.put_into("notice", _"Your delegation for this area has been deleted.")
28 else
29 slot.put_into("notice", _"Your delegation for this unit has been deleted.")
30 end
31 --]]
32 end
34 else
36 if not delegation then
37 delegation = Delegation:new()
38 delegation.truster_id = truster_id
39 delegation.unit_id = unit_id
40 delegation.area_id = area_id
41 delegation.issue_id = issue_id
42 if issue_id then
43 delegation.scope = "issue"
44 elseif area_id then
45 delegation.scope = "area"
46 elseif unit_id then
47 delegation.scope = "unit"
48 end
49 end
50 if trustee_id == 0 then
51 delegation.trustee_id = nil
52 else
53 delegation.trustee_id = trustee_id
54 end
56 delegation:save()
57 --[[
58 if issue_id then
59 slot.put_into("notice", _"Your delegation for this issue has been updated.")
60 elseif area_id then
61 slot.put_into("notice", _"Your delegation for this area has been updated.")
62 else
63 slot.put_into("notice", _"Your delegation for this unit has been updated.")
64 end
65 --]]
66 end

Impressum / About Us