liquid_feedback_frontend
annotate app/main/initiative/new.lua @ 7:3941792e8be6
Version beta3
Table allowed_policy is respected while creating new issues
Broken vote now/later link is not shown anymore (until it's implemented)
More user friendly error page
Minor spelling error corrected
Table allowed_policy is respected while creating new issues
Broken vote now/later link is not shown anymore (until it's implemented)
More user friendly error page
Minor spelling error corrected
author | bsw |
---|---|
date | Sat Jan 02 12:00:00 2010 +0100 (2010-01-02) |
parents | afd9f769c7ae |
children | 72c5e0ee7c98 |
rev | line source |
---|---|
bsw/jbe@0 | 1 local issue |
bsw/jbe@0 | 2 local area |
bsw/jbe@0 | 3 |
bsw/jbe@0 | 4 local issue_id = param.get("issue_id", atom.integer) |
bsw/jbe@0 | 5 if issue_id then |
bsw/jbe@0 | 6 issue = Issue:new_selector():add_where{"id=?",issue_id}:single_object_mode():exec() |
bsw/jbe@0 | 7 area = issue.area |
bsw/jbe@0 | 8 |
bsw/jbe@0 | 9 else |
bsw/jbe@0 | 10 local area_id = param.get("area_id", atom.integer) |
bsw/jbe@0 | 11 area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec() |
bsw/jbe@0 | 12 end |
bsw/jbe@0 | 13 |
bsw/jbe@0 | 14 if issue_id then |
bsw/jbe@0 | 15 slot.put_into("title", _"Add new initiative to issue") |
bsw/jbe@0 | 16 else |
bsw/jbe@0 | 17 slot.put_into("title", _"Create new issue") |
bsw/jbe@0 | 18 end |
bsw/jbe@0 | 19 |
bsw/jbe@0 | 20 ui.form{ |
bsw/jbe@0 | 21 module = "initiative", |
bsw/jbe@0 | 22 action = "create", |
bsw/jbe@0 | 23 params = { |
bsw/jbe@0 | 24 area_id = area.id, |
bsw/jbe@0 | 25 issue_id = issue and issue.id or nil |
bsw/jbe@0 | 26 }, |
bsw/jbe@0 | 27 attr = { class = "vertical" }, |
bsw/jbe@0 | 28 content = function() |
bsw/jbe@0 | 29 ui.field.text{ label = _"Area", value = area.name } |
bsw/jbe@0 | 30 if issue_id then |
bsw/jbe@0 | 31 ui.field.text{ label = _"Issue", value = issue_id } |
bsw/jbe@0 | 32 else |
bsw@7 | 33 local value |
bsw/jbe@0 | 34 ui.field.select{ |
bsw/jbe@0 | 35 label = _"Policy", |
bsw/jbe@0 | 36 name = "policy_id", |
bsw@7 | 37 foreign_records = area.allowed_policies, |
bsw/jbe@0 | 38 foreign_id = "id", |
bsw@7 | 39 foreign_name = "name", |
bsw@7 | 40 value = area.default_policy.id |
bsw/jbe@0 | 41 } |
bsw/jbe@0 | 42 end |
bsw/jbe@4 | 43 ui.field.text{ label = _"Name", name = "name" } |
bsw/jbe@4 | 44 ui.field.text{ label = _"Discussion URL", name = "discussion_url" } |
bsw/jbe@4 | 45 ui.field.select{ |
bsw/jbe@4 | 46 label = _"Wiki engine", |
bsw/jbe@4 | 47 name = "formatting_engine", |
bsw/jbe@4 | 48 foreign_records = { |
bsw/jbe@4 | 49 { id = "rocketwiki", name = "RocketWiki" }, |
bsw/jbe@4 | 50 { id = "compat", name = _"Traditional wiki syntax" } |
bsw/jbe@4 | 51 }, |
bsw/jbe@4 | 52 foreign_id = "id", |
bsw/jbe@4 | 53 foreign_name = "name" |
bsw/jbe@4 | 54 } |
bsw@2 | 55 ui.field.text{ label = _"Draft", name = "draft", multiline = true, attr = { style = "height: 50ex;" } } |
bsw/jbe@0 | 56 ui.submit{ text = _"Save" } |
bsw/jbe@0 | 57 end |
bsw/jbe@0 | 58 } |