liquid_feedback_frontend
view app/main/initiative/_action/create.lua @ 2:5c601807d397
Version alpha3
Dark green part of issue supporter bargraph represents all satisfied supporters, regardless of having seen the latest draft
Wiki formatting for drafts
Showing differences between two drafts of the same initiative
Display of outgoing delegation chains
Many other improvements
Dark green part of issue supporter bargraph represents all satisfied supporters, regardless of having seen the latest draft
Wiki formatting for drafts
Showing differences between two drafts of the same initiative
Display of outgoing delegation chains
Many other improvements
author | bsw |
---|---|
date | Mon Nov 23 12:00:00 2009 +0100 (2009-11-23) |
parents | 3bfb2fcf7ab9 |
children | 768faea1096d |
line source
1 local issue
2 local area
4 db:query("BEGIN")
6 local issue_id = param.get("issue_id", atom.integer)
7 if issue_id then
8 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec()
9 area = issue.area
11 else
12 local area_id = param.get("area_id", atom.integer)
13 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec()
14 end
16 local initiative = Initiative:new()
18 if not issue then
19 issue = Issue:new()
20 issue.area_id = area.id
21 issue.policy_id = param.get("policy_id", atom.integer)
22 issue:save()
23 end
25 initiative.issue_id = issue.id
26 param.update(initiative, "name")
27 initiative:save()
29 local draft = Draft:new()
30 draft.initiative_id = initiative.id
31 draft.content = param.get("draft")
32 draft.author_id = app.session.member.id
33 draft:save()
35 local initiator = Initiator:new()
36 initiator.initiative_id = initiative.id
37 initiator.member_id = app.session.member.id
38 initiator:save()
40 local supporter = Supporter:new()
41 supporter.initiative_id = initiative.id
42 supporter.member_id = app.session.member.id
43 supporter.draft_id = draft.id
44 supporter:save()
46 db:query("COMMIT")
48 slot.put_into("notice", _"Initiative successfully created")
50 request.redirect{
51 module = "initiative",
52 view = "show",
53 id = initiative.id
54 }