liquid_feedback_frontend
annotate app/main/initiative/_action/create.lua @ 3:768faea1096d
Version alpha4
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
author | bsw |
---|---|
date | Mon Nov 30 12:00:00 2009 +0100 (2009-11-30) |
parents | 3bfb2fcf7ab9 |
children | 80c215dbf076 |
rev | line source |
---|---|
bsw/jbe@0 | 1 local issue |
bsw/jbe@0 | 2 local area |
bsw/jbe@0 | 3 |
bsw/jbe@0 | 4 db:query("BEGIN") |
bsw/jbe@0 | 5 |
bsw/jbe@0 | 6 local issue_id = param.get("issue_id", atom.integer) |
bsw/jbe@0 | 7 if issue_id then |
bsw/jbe@0 | 8 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec() |
bsw/jbe@0 | 9 area = issue.area |
bsw/jbe@0 | 10 |
bsw/jbe@0 | 11 else |
bsw/jbe@0 | 12 local area_id = param.get("area_id", atom.integer) |
bsw/jbe@0 | 13 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec() |
bsw/jbe@0 | 14 end |
bsw/jbe@0 | 15 |
bsw/jbe@0 | 16 local initiative = Initiative:new() |
bsw/jbe@0 | 17 |
bsw/jbe@0 | 18 if not issue then |
bsw/jbe@0 | 19 issue = Issue:new() |
bsw/jbe@0 | 20 issue.area_id = area.id |
bsw/jbe@0 | 21 issue.policy_id = param.get("policy_id", atom.integer) |
bsw/jbe@0 | 22 issue:save() |
bsw/jbe@0 | 23 end |
bsw/jbe@0 | 24 |
bsw/jbe@0 | 25 initiative.issue_id = issue.id |
bsw@3 | 26 |
bsw@3 | 27 param.update(initiative, "name", "discussion_url") |
bsw/jbe@0 | 28 initiative:save() |
bsw/jbe@0 | 29 |
bsw/jbe@0 | 30 local draft = Draft:new() |
bsw/jbe@0 | 31 draft.initiative_id = initiative.id |
bsw/jbe@0 | 32 draft.content = param.get("draft") |
bsw/jbe@0 | 33 draft.author_id = app.session.member.id |
bsw/jbe@0 | 34 draft:save() |
bsw/jbe@0 | 35 |
bsw/jbe@0 | 36 local initiator = Initiator:new() |
bsw/jbe@0 | 37 initiator.initiative_id = initiative.id |
bsw/jbe@0 | 38 initiator.member_id = app.session.member.id |
bsw/jbe@0 | 39 initiator:save() |
bsw/jbe@0 | 40 |
bsw/jbe@0 | 41 local supporter = Supporter:new() |
bsw/jbe@0 | 42 supporter.initiative_id = initiative.id |
bsw/jbe@0 | 43 supporter.member_id = app.session.member.id |
bsw/jbe@0 | 44 supporter.draft_id = draft.id |
bsw/jbe@0 | 45 supporter:save() |
bsw/jbe@0 | 46 |
bsw/jbe@0 | 47 db:query("COMMIT") |
bsw/jbe@0 | 48 |
bsw/jbe@0 | 49 slot.put_into("notice", _"Initiative successfully created") |
bsw/jbe@0 | 50 |
bsw/jbe@0 | 51 request.redirect{ |
bsw/jbe@0 | 52 module = "initiative", |
bsw/jbe@0 | 53 view = "show", |
bsw/jbe@0 | 54 id = initiative.id |
bsw/jbe@0 | 55 } |