liquid_feedback_frontend
annotate app/main/initiative/new.lua @ 95:6a12fb7e4963
Suggestion API, draft preview, word based diff, multiple fixes
- Added suggestion API
- Initiative API: Drafts optionally delivered as rendered html fragment
- Initiative API: Fixed wrong output of revoked timestamp when using JSON
- Preview added for initiative drafts
- Improved (word based) diff added
- Improved suggestion list
- Added missing sorting of initiative in vote list
- Filter state for member page initiative lists
- Fixed wrong status output in member history
- Fixed wrongly closed div in layout
- Added suggestion API
- Initiative API: Drafts optionally delivered as rendered html fragment
- Initiative API: Fixed wrong output of revoked timestamp when using JSON
- Preview added for initiative drafts
- Improved (word based) diff added
- Improved suggestion list
- Added missing sorting of initiative in vote list
- Filter state for member page initiative lists
- Fixed wrong status output in member history
- Fixed wrongly closed div in layout
author | bsw |
---|---|
date | Mon Aug 30 21:52:19 2010 +0200 (2010-08-30) |
parents | 3ec1dea6eefb |
children | fa55c8ded9fd |
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@19 | 15 slot.put_into("title", _"Add alternative 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@52 | 30 slot.put("<br />") |
bsw/jbe@0 | 31 if issue_id then |
bsw/jbe@0 | 32 ui.field.text{ label = _"Issue", value = issue_id } |
bsw/jbe@0 | 33 else |
bsw@10 | 34 tmp = { { id = -1, name = _"Please choose a policy" } } |
bsw@10 | 35 for i, allowed_policy in ipairs(area.allowed_policies) do |
bsw@10 | 36 tmp[#tmp+1] = allowed_policy |
bsw@10 | 37 end |
bsw/jbe@0 | 38 ui.field.select{ |
bsw/jbe@0 | 39 label = _"Policy", |
bsw/jbe@0 | 40 name = "policy_id", |
bsw@10 | 41 foreign_records = tmp, |
bsw/jbe@0 | 42 foreign_id = "id", |
bsw@7 | 43 foreign_name = "name", |
bsw@95 | 44 value = area.default_policy and area.default_policy.id or param.get("policy_id", atom.integer) |
bsw/jbe@0 | 45 } |
bsw@64 | 46 ui.tag{ |
bsw@64 | 47 tag = "div", |
bsw@64 | 48 content = function() |
bsw@64 | 49 ui.tag{ |
bsw@64 | 50 tag = "label", |
bsw@64 | 51 attr = { class = "ui_field_label" }, |
bsw@64 | 52 content = function() slot.put(" ") end, |
bsw@64 | 53 } |
bsw@64 | 54 ui.tag{ |
bsw@64 | 55 content = function() |
bsw@64 | 56 ui.link{ |
bsw@64 | 57 text = _"Information about the available policies", |
bsw@64 | 58 module = "policy", |
bsw@64 | 59 view = "list" |
bsw@64 | 60 } |
bsw@64 | 61 slot.put(" ") |
bsw@64 | 62 ui.link{ |
bsw@64 | 63 attr = { target = "_blank" }, |
bsw@64 | 64 text = _"(new window)", |
bsw@64 | 65 module = "policy", |
bsw@64 | 66 view = "list" |
bsw@64 | 67 } |
bsw@64 | 68 end |
bsw@64 | 69 } |
bsw@64 | 70 end |
bsw@64 | 71 } |
bsw/jbe@0 | 72 end |
bsw@95 | 73 |
bsw@95 | 74 if param.get("preview") then |
bsw@95 | 75 ui.heading{ level = 1, content = encode.html(param.get("name")) } |
bsw@95 | 76 local discussion_url = param.get("discussion_url") |
bsw@95 | 77 ui.container{ |
bsw@95 | 78 attr = { class = "ui_field_label" }, |
bsw@95 | 79 content = _"Discussion with initiators" |
bsw@95 | 80 } |
bsw@95 | 81 ui.tag{ |
bsw@95 | 82 tag = "span", |
bsw@95 | 83 content = function() |
bsw@95 | 84 if discussion_url:find("^https?://") then |
bsw@95 | 85 if discussion_url and #discussion_url > 0 then |
bsw@95 | 86 ui.link{ |
bsw@95 | 87 attr = { |
bsw@95 | 88 class = "actions", |
bsw@95 | 89 target = "_blank", |
bsw@95 | 90 title = discussion_url |
bsw@95 | 91 }, |
bsw@95 | 92 content = discussion_url, |
bsw@95 | 93 external = discussion_url |
bsw@95 | 94 } |
bsw@95 | 95 end |
bsw@95 | 96 else |
bsw@95 | 97 slot.put(encode.html(discussion_url)) |
bsw@95 | 98 end |
bsw@95 | 99 end |
bsw@95 | 100 } |
bsw@95 | 101 ui.container{ |
bsw@95 | 102 attr = { class = "draft_content wiki" }, |
bsw@95 | 103 content = function() |
bsw@95 | 104 slot.put(format.wiki_text(param.get("draft"), param.get("formatting_engine"))) |
bsw@95 | 105 end |
bsw@95 | 106 } |
bsw@95 | 107 slot.put("<br />") |
bsw@95 | 108 ui.submit{ text = _"Save" } |
bsw@95 | 109 slot.put("<br />") |
bsw@95 | 110 slot.put("<br />") |
bsw@95 | 111 end |
bsw/jbe@52 | 112 slot.put("<br />") |
bsw@95 | 113 |
bsw@95 | 114 ui.field.text{ |
bsw@95 | 115 label = _"Title of initiative", |
bsw@95 | 116 name = "name", |
bsw@95 | 117 value = param.get("name") |
bsw@95 | 118 } |
bsw@95 | 119 ui.field.text{ |
bsw@95 | 120 label = _"Discussion URL", |
bsw@95 | 121 name = "discussion_url", |
bsw@95 | 122 value = param.get("discussion_url") |
bsw@95 | 123 } |
bsw/jbe@4 | 124 ui.field.select{ |
bsw/jbe@4 | 125 label = _"Wiki engine", |
bsw/jbe@4 | 126 name = "formatting_engine", |
bsw/jbe@4 | 127 foreign_records = { |
bsw/jbe@4 | 128 { id = "rocketwiki", name = "RocketWiki" }, |
bsw/jbe@4 | 129 { id = "compat", name = _"Traditional wiki syntax" } |
bsw/jbe@4 | 130 }, |
bsw/jbe@4 | 131 foreign_id = "id", |
bsw@95 | 132 foreign_name = "name", |
bsw@95 | 133 value = param.get("formatting_engine") |
bsw/jbe@4 | 134 } |
bsw@95 | 135 ui.field.text{ |
bsw@95 | 136 label = _"Draft", |
bsw@95 | 137 name = "draft", |
bsw@95 | 138 multiline = true, |
bsw@95 | 139 attr = { style = "height: 50ex;" }, |
bsw@95 | 140 value = param.get("draft") |
bsw@95 | 141 } |
bsw@95 | 142 ui.submit{ name = "preview", text = _"Preview" } |
bsw/jbe@0 | 143 ui.submit{ text = _"Save" } |
bsw/jbe@0 | 144 end |
bsw/jbe@0 | 145 } |