liquid_feedback_frontend

annotate app/main/report/area.lua @ 32:4ae09a588103

Changed style.css: Member thumb a bit smaller
author bsw
date Tue Feb 23 21:10:23 2010 +0100 (2010-02-23)
parents a6caaff47205
children a851cc1d9903
rev   line source
bsw@31 1 function show_issue(issue, initiatives_selector)
bsw@31 2 ui.list{
bsw@31 3 records = initiatives_selector:exec(),
bsw@31 4 columns = {
bsw@31 5 {
bsw@31 6 label = _"Date",
bsw@31 7 label_attr = { style = "width: 7.5em;" },
bsw@31 8 content = function(initiative)
bsw@31 9 slot.put(format.date(issue.closed))
bsw@31 10 end
bsw@31 11 },
bsw@31 12 {
bsw@31 13 label_attr = { style = "width: 8em;" },
bsw@31 14 label = _"Id",
bsw@31 15 content = function(initiative)
bsw@31 16 ui.link{
bsw@31 17 external = "",
bsw@31 18 text = "#" .. tostring(issue.id) .. "." .. tostring(initiative.id),
bsw@31 19 attr = {
bsw@31 20 onclick =
bsw@31 21 "openEl('initiative_" .. tostring(initiative.id) .. "');" ..
bsw@31 22 "return(false);"
bsw@31 23 }
bsw@31 24 }
bsw@31 25 end
bsw@31 26 },
bsw@31 27 {
bsw@31 28 label = _"Rank",
bsw@31 29 label_attr = { style = "width: 3em;" },
bsw@31 30 field_attr = { style = "text-align: right;" },
bsw@31 31 content = function(initiative)
bsw@31 32 ui.field.rank{ value = initiative.rank }
bsw@31 33 end
bsw@31 34 },
bsw@31 35 {
bsw@31 36 label = _"Name",
bsw@31 37 content = function(initiative)
bsw@31 38 if initiative.rank and initiative.rank == 1 then
bsw@31 39 slot.put("<b>")
bsw@31 40 end
bsw@31 41 ui.field.text{ value = initiative.name }
bsw@31 42 if initiative.rank and initiative.rank == 1 then
bsw@31 43 slot.put("</b>")
bsw@31 44 end
bsw@31 45 end
bsw@31 46 }
bsw@31 47 }
bsw@31 48 }
bsw@31 49 end
bsw@31 50
bsw@31 51 function link_issue(issue)
bsw@31 52 ui.link{
bsw@31 53 external = "",
bsw@31 54 attr = {
bsw@31 55 style = "text-decoration: none;",
bsw@31 56 name = "issue_" .. tostring(issue.id),
bsw@31 57 onclick =
bsw@31 58 "openEl('issue_" .. tostring(issue.id) .. "');" ..
bsw@31 59 "return(false);"
bsw@31 60 },
bsw@31 61 content = function()
bsw@31 62 ui.heading{
bsw@31 63 attr = { style = "background-color: #ddd; color: #000;" },
bsw@31 64 content = _("##{id}", { id = issue.id })
bsw@31 65 }
bsw@31 66 end
bsw@31 67 }
bsw@31 68 end
bsw@31 69
bsw@31 70
bsw@31 71 local area = param.get("area", "table")
bsw@31 72
bsw@31 73 local issue_selector = Issue:new_selector()
bsw@31 74 issue_selector:add_where{ "area_id = ?", area.id }
bsw@31 75 issue_selector:add_where("closed NOTNULL")
bsw@31 76 issue_selector:add_order_by("id")
bsw@31 77
bsw@31 78
bsw@31 79 local issues = issue_selector:exec()
bsw@31 80
bsw@31 81 ui.container{
bsw@31 82 attr = {
bsw@31 83 id = "area_" .. tostring(area.id)
bsw@31 84 },
bsw@31 85 content = function()
bsw@31 86
bsw@31 87 link_area(area)
bsw@31 88
bsw@31 89 for i, issue in ipairs(issues) do
bsw@31 90
bsw@31 91 link_issue(issue)
bsw@31 92
bsw@31 93 local initiatives_selector = issue:get_reference_selector("initiatives")
bsw@31 94
bsw@31 95 local initiatives_count = initiatives_selector:count()
bsw@31 96
bsw@31 97 initiatives_selector:add_order_by("rank")
bsw@31 98 initiatives_selector:limit(3)
bsw@31 99
bsw@31 100 show_issue(issue, initiatives_selector)
bsw@31 101
bsw@31 102 if initiatives_count > 3 then
bsw@31 103 ui.link{
bsw@31 104 attr = {
bsw@31 105 style = "margin-left: 8em; font-style: italic;",
bsw@31 106 onclick = "openEl('issue_" .. tostring(issue.id) .. "'); return(false);"
bsw@31 107 },
bsw@31 108 content = _("and #{count} more initiatives", { count = initiatives_count - 3 }),
bsw@31 109 external = ""
bsw@31 110 }
bsw@31 111 end
bsw@31 112
bsw@31 113 slot.put("<br />")
bsw@31 114
bsw@31 115 end
bsw@31 116
bsw@31 117 end
bsw@31 118 }
bsw@31 119
bsw@31 120 local next_issue = issues[1]
bsw@31 121 if next_issue then
bsw@31 122 ui.script{ script = "next_issues['area_" .. tostring(area.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" }
bsw@31 123 end
bsw@31 124
bsw@31 125 if next_issue then
bsw@31 126 local next_initiative = next_issue.initiatives[1]
bsw@31 127 if next_initiative then
bsw@31 128 ui.script{ script = "next_initiatives['area_" .. tostring(area.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" }
bsw@31 129 end
bsw@31 130 end
bsw@31 131
bsw@31 132
bsw@31 133 for i, issue in ipairs(issues) do
bsw@31 134 local initiatives_selector = issue:get_reference_selector("initiatives")
bsw@31 135 :add_order_by("rank")
bsw@31 136
bsw@31 137 local initiatives = initiatives_selector:exec()
bsw@31 138
bsw@31 139 ui.container{
bsw@31 140 attr = {
bsw@31 141 id = "issue_" .. tostring(issue.id)
bsw@31 142 },
bsw@31 143 content = function()
bsw@31 144 link_area(area)
bsw@31 145 link_issue(issue)
bsw@31 146 show_issue(issue, initiatives_selector)
bsw@31 147 end
bsw@31 148 }
bsw@31 149
bsw@31 150 local previous_issue = issues[i-1]
bsw@31 151 if previous_issue then
bsw@31 152 ui.script{ script = "prev_issues['issue_" .. tostring(issue.id) .. "'] = 'issue_" .. tostring(previous_issue.id) .. "';" }
bsw@31 153 end
bsw@31 154
bsw@31 155 local next_initiative = initiatives[1]
bsw@31 156 if next_initiative then
bsw@31 157 ui.script{ script = "next_initiatives['issue_" .. tostring(issue.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" }
bsw@31 158 end
bsw@31 159
bsw@31 160 local next_issue = issues[i+1]
bsw@31 161 if next_issue then
bsw@31 162 ui.script{ script = "next_issues['issue_" .. tostring(issue.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" }
bsw@31 163 end
bsw@31 164
bsw@31 165 ui.script{
bsw@31 166 script = "document.getElementById('issue_" .. tostring(issue.id) .. "').style.display = 'none';"
bsw@31 167 }
bsw@31 168
bsw@31 169
bsw@31 170 for j, initiative in ipairs(initiatives) do
bsw@31 171
bsw@31 172 ui.container{
bsw@31 173 attr = {
bsw@31 174 id = "initiative_" .. tostring(initiative.id)
bsw@31 175 },
bsw@31 176 content = function()
bsw@31 177 execute.view{
bsw@31 178 module = "report",
bsw@31 179 view = "initiative",
bsw@31 180 params = { initiative = initiative }
bsw@31 181 }
bsw@31 182 slot.put("<br />")
bsw@31 183 slot.put("<br />")
bsw@31 184 slot.put("<br />")
bsw@31 185 slot.put("<br />")
bsw@31 186 slot.put("<br />")
bsw@31 187 end
bsw@31 188 }
bsw@31 189
bsw@31 190 local previous_issue = issues[i-1]
bsw@31 191 if previous_issue then
bsw@31 192 ui.script{ script = "prev_issues['initiative_" .. tostring(initiative.id) .. "'] = 'issue_" .. tostring(previous_issue.id) .. "';" }
bsw@31 193 end
bsw@31 194
bsw@31 195 local previous_initiative = initiatives[j-1]
bsw@31 196 if previous_initiative then
bsw@31 197 ui.script{ script = "prev_initiatives['initiative_" .. tostring(initiative.id) .. "'] = 'initiative_" .. tostring(previous_initiative.id) .. "';" }
bsw@31 198 end
bsw@31 199
bsw@31 200 local next_initiative = initiatives[j+1]
bsw@31 201 if next_initiative then
bsw@31 202 ui.script{ script = "next_initiatives['initiative_" .. tostring(initiative.id) .. "'] = 'initiative_" .. tostring(next_initiative.id) .. "';" }
bsw@31 203 end
bsw@31 204
bsw@31 205 local next_issue = issues[i+1]
bsw@31 206 if next_issue then
bsw@31 207 ui.script{ script = "next_issues['initiative_" .. tostring(initiative.id) .. "'] = 'issue_" .. tostring(next_issue.id) .. "';" }
bsw@31 208 end
bsw@31 209
bsw@31 210 ui.script{
bsw@31 211 script = "document.getElementById('initiative_" .. tostring(initiative.id) .. "').style.display = 'none';"
bsw@31 212 }
bsw@31 213
bsw@31 214 end
bsw@31 215 end
bsw@31 216
bsw@31 217 ui.script{
bsw@31 218 script = "document.getElementById('area_" .. tostring(area.id) .. "').style.display = 'none';"
bsw@31 219 }
bsw@31 220

Impressum / About Us