liquid_feedback_frontend
annotate app/main/initiative/show.lua @ 1:dd0109e81922
Version alpha2
Minor bug in bargraph output for suggestions fixed
Minor bug in bargraph output for suggestions fixed
| author | bsw |
|---|---|
| date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
| parents | 3bfb2fcf7ab9 |
| children | 5c601807d397 |
| rev | line source |
|---|---|
| bsw/jbe@0 | 1 local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec() |
| bsw/jbe@0 | 2 |
| bsw/jbe@0 | 3 slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />') |
| bsw/jbe@0 | 4 |
| bsw/jbe@0 | 5 execute.view{ |
| bsw/jbe@0 | 6 module = "supporter", |
| bsw/jbe@0 | 7 view = "_show_box", |
| bsw/jbe@0 | 8 params = { initiative = initiative } |
| bsw/jbe@0 | 9 } |
| bsw/jbe@0 | 10 |
| bsw/jbe@0 | 11 execute.view{ |
| bsw/jbe@0 | 12 module = "delegation", |
| bsw/jbe@0 | 13 view = "_show_box", |
| bsw/jbe@0 | 14 params = { issue_id = initiative.issue_id } |
| bsw/jbe@0 | 15 } |
| bsw/jbe@0 | 16 |
| bsw/jbe@0 | 17 |
| bsw/jbe@0 | 18 slot.select("path", function() |
| bsw/jbe@0 | 19 ui.link{ |
| bsw/jbe@0 | 20 content = _"Area '#{name}'":gsub("#{name}", initiative.issue.area.name), |
| bsw/jbe@0 | 21 module = "area", |
| bsw/jbe@0 | 22 view = "show", |
| bsw/jbe@0 | 23 id = initiative.issue.area.id |
| bsw/jbe@0 | 24 } |
| bsw/jbe@0 | 25 ui.container{ content = "::" } |
| bsw/jbe@0 | 26 ui.link{ |
| bsw/jbe@0 | 27 content = _"Issue ##{id} (#{policy_name})":gsub("#{id}", initiative.issue.id):gsub("#{policy_name}", initiative.issue.policy.name), |
| bsw/jbe@0 | 28 module = "issue", |
| bsw/jbe@0 | 29 view = "show", |
| bsw/jbe@0 | 30 id = initiative.issue.id |
| bsw/jbe@0 | 31 } |
| bsw/jbe@0 | 32 end) |
| bsw/jbe@0 | 33 |
| bsw/jbe@0 | 34 slot.put_into("title", encode.html(_"Initiative: '#{name}'":gsub("#{name}", initiative.shortened_name) )) |
| bsw/jbe@0 | 35 |
| bsw/jbe@0 | 36 slot.select("actions", function() |
| bsw/jbe@0 | 37 |
| bsw/jbe@0 | 38 ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name) |
| bsw/jbe@0 | 39 |
| bsw/jbe@0 | 40 end) |
| bsw/jbe@0 | 41 |
| bsw/jbe@0 | 42 |
| bsw/jbe@0 | 43 ui.container{ |
| bsw/jbe@0 | 44 attr = { id = "add_suggestion_form", class = "hidden_inline_form" }, |
| bsw/jbe@0 | 45 content = function() |
| bsw/jbe@0 | 46 |
| bsw/jbe@0 | 47 ui.link{ |
| bsw/jbe@0 | 48 content = _"Close", |
| bsw/jbe@0 | 49 attr = { |
| bsw/jbe@0 | 50 onclick = "document.getElementById('add_suggestion_form').style.display='none';return(false)", |
| bsw/jbe@0 | 51 style = "float: right;" |
| bsw/jbe@0 | 52 } |
| bsw/jbe@0 | 53 } |
| bsw/jbe@0 | 54 |
| bsw/jbe@0 | 55 ui.field.text{ attr = { class = "head" }, value = _"Add new suggestion" } |
| bsw/jbe@0 | 56 |
| bsw/jbe@0 | 57 |
| bsw/jbe@0 | 58 ui.form{ |
| bsw/jbe@0 | 59 module = "suggestion", |
| bsw/jbe@0 | 60 action = "add", |
| bsw/jbe@0 | 61 params = { initiative_id = initiative.id }, |
| bsw/jbe@0 | 62 routing = { |
| bsw/jbe@0 | 63 default = { |
| bsw/jbe@0 | 64 mode = "redirect", |
| bsw/jbe@0 | 65 module = "initiative", |
| bsw/jbe@0 | 66 view = "show", |
| bsw/jbe@0 | 67 id = initiative.id, |
| bsw/jbe@0 | 68 params = { tab = "suggestion" } |
| bsw/jbe@0 | 69 } |
| bsw/jbe@0 | 70 }, |
| bsw/jbe@0 | 71 attr = { class = "vertical" }, |
| bsw/jbe@0 | 72 content = function() |
| bsw/jbe@0 | 73 ui.field.text{ label = _"Name", name = "name" } |
| bsw/jbe@0 | 74 ui.field.text{ label = _"Description", name = "description", multiline = true } |
| bsw/jbe@0 | 75 ui.field.select{ |
| bsw/jbe@0 | 76 label = _"Degree", |
| bsw/jbe@0 | 77 name = "degree", |
| bsw/jbe@0 | 78 foreign_records = { |
| bsw/jbe@0 | 79 { id = 1, name = _"should"}, |
| bsw/jbe@0 | 80 { id = 2, name = _"must"}, |
| bsw/jbe@0 | 81 }, |
| bsw/jbe@0 | 82 foreign_id = "id", |
| bsw/jbe@0 | 83 foreign_name = "name" |
| bsw/jbe@0 | 84 } |
| bsw/jbe@0 | 85 ui.submit{ text = _"Commit suggestion" } |
| bsw/jbe@0 | 86 end |
| bsw/jbe@0 | 87 } |
| bsw/jbe@0 | 88 end |
| bsw/jbe@0 | 89 } |
| bsw/jbe@0 | 90 |
| bsw/jbe@0 | 91 |
| bsw/jbe@0 | 92 ui.tabs{ |
| bsw/jbe@0 | 93 { |
| bsw/jbe@0 | 94 name = "current_draft", |
| bsw/jbe@0 | 95 label = _"Current draft", |
| bsw/jbe@0 | 96 content = function() |
| bsw/jbe@0 | 97 execute.view{ module = "draft", view = "_show", params = { draft = initiative.current_draft } } |
| bsw/jbe@0 | 98 if Initiator:by_pk(initiative.id, app.session.member.id) then |
| bsw/jbe@0 | 99 ui.link{ |
| bsw/jbe@0 | 100 content = function() |
| bsw/jbe@0 | 101 ui.image{ static = "icons/16/script_add.png" } |
| bsw/jbe@0 | 102 slot.put(_"Add new draft") |
| bsw/jbe@0 | 103 end, |
| bsw/jbe@0 | 104 module = "draft", |
| bsw/jbe@0 | 105 view = "new", |
| bsw/jbe@0 | 106 params = { initiative_id = initiative.id } |
| bsw/jbe@0 | 107 } |
| bsw/jbe@0 | 108 end |
| bsw/jbe@0 | 109 end |
| bsw/jbe@0 | 110 }, |
| bsw/jbe@0 | 111 { |
| bsw/jbe@0 | 112 name = "details", |
| bsw/jbe@0 | 113 label = _"Details", |
| bsw/jbe@0 | 114 content = function() |
| bsw/jbe@0 | 115 ui.form{ |
| bsw/jbe@0 | 116 attr = { class = "vertical" }, |
| bsw/jbe@0 | 117 record = initiative, |
| bsw/jbe@0 | 118 readonly = true, |
| bsw/jbe@0 | 119 content = function() |
| bsw/jbe@0 | 120 ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name } |
| bsw/jbe@0 | 121 ui.field.text{ |
| bsw/jbe@0 | 122 label = _"Created at", |
| bsw/jbe@0 | 123 value = tostring(initiative.created) |
| bsw/jbe@0 | 124 } |
| bsw/jbe@0 | 125 ui.field.text{ |
| bsw/jbe@0 | 126 label = _"Created at", |
| bsw/jbe@0 | 127 value = format.timestamp(initiative.created) |
| bsw/jbe@0 | 128 } |
| bsw/jbe@0 | 129 ui.field.date{ label = _"Revoked at", name = "revoked" } |
| bsw/jbe@0 | 130 ui.field.boolean{ label = _"Admitted", name = "admitted" } |
| bsw/jbe@0 | 131 end |
| bsw/jbe@0 | 132 } |
| bsw/jbe@0 | 133 end |
| bsw/jbe@0 | 134 }, |
| bsw/jbe@0 | 135 { |
| bsw/jbe@0 | 136 name = "suggestion", |
| bsw/jbe@0 | 137 label = _"Suggestions", |
| bsw/jbe@0 | 138 content = function() |
| bsw/jbe@0 | 139 execute.view{ module = "suggestion", view = "_list", params = { suggestions_selector = initiative:get_reference_selector("suggestions") } } |
| bsw/jbe@0 | 140 slot.put("<br />") |
| bsw/jbe@0 | 141 if not initiative.issue.frozen and not initiative.issue.closed then |
| bsw/jbe@0 | 142 ui.link{ |
| bsw/jbe@0 | 143 content = function() |
| bsw/jbe@0 | 144 ui.image{ static = "icons/16/comment_add.png" } |
| bsw/jbe@0 | 145 slot.put(_"Add new suggestion") |
| bsw/jbe@0 | 146 end, |
| bsw/jbe@0 | 147 attr = { onclick = "document.getElementById('add_suggestion_form').style.display='block';return(false)" }, |
| bsw/jbe@0 | 148 static = "#" |
| bsw/jbe@0 | 149 } |
| bsw/jbe@0 | 150 end |
| bsw/jbe@0 | 151 end |
| bsw/jbe@0 | 152 }, |
| bsw/jbe@0 | 153 { |
| bsw/jbe@0 | 154 name = "supporter", |
| bsw/jbe@0 | 155 label = _"Supporter", |
| bsw/jbe@0 | 156 content = function() |
| bsw/jbe@0 | 157 execute.view{ module = "member", view = "_list", params = { members_selector = initiative:get_reference_selector("supporting_members") } } |
| bsw/jbe@0 | 158 end |
| bsw/jbe@0 | 159 }, |
| bsw/jbe@0 | 160 { |
| bsw/jbe@0 | 161 name = "initiators", |
| bsw/jbe@0 | 162 label = _"Initiators", |
| bsw/jbe@0 | 163 content = function() |
| bsw/jbe@0 | 164 execute.view{ module = "member", view = "_list", params = { members_selector = initiative:get_reference_selector("initiating_members") } } |
| bsw/jbe@0 | 165 end |
| bsw/jbe@0 | 166 }, |
| bsw/jbe@0 | 167 { |
| bsw/jbe@0 | 168 name = "drafts", |
| bsw/jbe@0 | 169 label = _"Old drafts", |
| bsw/jbe@0 | 170 content = function() |
| bsw/jbe@0 | 171 execute.view{ module = "draft", view = "_list", params = { drafts = initiative.drafts } } |
| bsw/jbe@0 | 172 end |
| bsw/jbe@0 | 173 }, |
| bsw/jbe@0 | 174 } |
| bsw/jbe@0 | 175 |
| bsw/jbe@0 | 176 |