liquid_feedback_frontend
view app/main/timeline/_list.lua @ 141:20e0b64cc1f9
use monospace/pre data on suggestion display and entry
this allows better formatting on the user suggestions without the overhead of using wiki there
fixes bug #215
this allows better formatting on the user suggestions without the overhead of using wiki there
fixes bug #215
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Wed Oct 06 14:34:45 2010 +0200 (2010-10-06) |
parents | 166fd10c7e81 |
children | 90520c9fca44 |
line source
1 local timeline_selector = param.get("timeline_selector", "table")
2 local event_names = param.get("event_names", "table")
3 local initiatives_per_page = param.get("initiatives_per_page", atom.number) or 3
6 -- test if selector is valid
7 local test_selector = timeline_selector:get_db_conn():new_selector()
8 test_selector:add_field('count(1)')
9 test_selector:add_from(timeline_selector)
10 test_selector:single_object_mode()
12 err, x = test_selector:try_exec()
14 if err then
15 slot.put_into("error", _"Invalid query")
16 else
17 ui.paginate{
18 per_page = param.get("per_page", atom.number) or 25,
19 selector = timeline_selector,
20 content = function()
21 local timelines = timeline_selector:exec()
22 timelines:load("issue")
23 timelines:load("initiative")
24 timelines:load("member")
25 ui.list{
26 attr = { class = "nohover" },
27 records = timelines,
28 columns = {
29 {
30 field_attr = { style = "width: 10em;" },
31 content = function(timeline)
32 ui.field.text{
33 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
34 value = format.time(timeline.occurrence)
35 }
37 ui.field.text{
38 attr = { style = "font-size: 75%; font-weight: bold;"},
39 value = event_names[timeline.event] or timeline.event
40 }
41 if timeline.event == "draft_created" and timeline.count > 1 then
42 ui.field.text{
43 attr = { style = "font-size: 75%;"},
44 value = _("(#{more_count} duplicates removed)", { more_count = timeline.count - 1 })
45 }
46 end
47 end
48 },
49 {
50 content = function(timeline)
51 local issue
52 local initiative
53 if timeline.issue then
54 issue = timeline.issue
55 elseif timeline.initiative then
56 initiative = timeline.initiative
57 issue = initiative.issue
58 elseif timeline.draft then
59 initiative = timeline.draft.initiative
60 issue = initiative.issue
61 elseif timeline.suggestion then
62 initiative = timeline.suggestion.initiative
63 issue = initiative.issue
64 end
65 if issue then
66 if timeline.is_interested then
67 local label = _"You are interested in this issue",
68 ui.image{
69 attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" },
70 static = "icons/16/eye.png"
71 }
72 end
73 slot.put(" ")
74 ui.tag{
75 tag = "span",
76 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
77 content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id })
78 }
79 else
80 ui.tag{
81 tag = "span",
82 attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"},
83 content = function() slot.put(" ") end
84 }
85 end
87 if timeline.member then
88 execute.view{
89 module = "member_image",
90 view = "_show",
91 params = {
92 member = timeline.member,
93 image_type = "avatar",
94 show_dummy = true
95 }
96 }
97 ui.link{
98 content = timeline.member.name,
99 module = "member",
100 view = "show",
101 id = timeline.member.id
102 }
103 end
104 if timeline.issue then
105 local initiatives_selector = timeline.issue
106 :get_reference_selector("initiatives")
107 execute.view{
108 module = "initiative",
109 view = "_list",
110 params = {
111 issue = timeline.issue,
112 initiatives_selector = initiatives_selector,
113 per_page = initiatives_per_page,
114 no_sort = true,
115 limit = initiatives_per_page
116 }
117 }
118 elseif initiative then
119 execute.view{
120 module = "initiative",
121 view = "_list",
122 params = {
123 issue = initiative.issue,
124 initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id },
125 per_page = initiatives_per_page,
126 no_sort = true
127 }
128 }
129 end
130 if timeline.suggestion then
131 ui.link{
132 module = "suggestion",
133 view = "show",
134 id = timeline.suggestion.id,
135 content = timeline.suggestion.name
136 }
137 end
138 end
139 },
140 }
141 }
142 end
143 }
144 end