liquid_feedback_frontend

view app/main/suggestion/_list.lua @ 1668:6d75df24e66e

Updated German translation
author bsw
date Sun Mar 07 09:52:36 2021 +0100 (2021-03-07)
parents a54d75e313d1
children
line source
2 local initiative = param.get("initiative", "table")
3 local suggestions_selector = param.get("suggestions_selector", "table")
5 suggestions_selector:add_order_by("proportional_order NULLS LAST, plus2_unfulfilled_count + plus1_unfulfilled_count DESC, id")
7 local ui_filters = ui.filters
8 if true or not show_filter then
9 ui_filters = function(args) args.content() end
10 end
12 ui.container{ attr = { class = "initiative_head" },
13 content = function()
14 ui.tag{ tag = "a", attr = { class = "title", name = "suggestions" }, content = _"Suggestions" }
15 ui.container{ attr = { class = "content" }, content = function()
16 ui.paginate{
17 selector = suggestions_selector,
18 anchor = "suggestions",
19 content = function()
20 local suggestions = suggestions_selector:exec()
21 if #suggestions < 1 then
22 if not initiative.issue.fully_frozen and not initiative.issue.closed then
23 ui.tag{ content = _"No suggestions yet" }
24 else
25 ui.tag{ content = _"No suggestions" }
26 end
27 else
28 ui.list{
29 attr = { style = "table-layout: fixed;" },
30 records = suggestions,
31 columns = {
32 {
33 label_attr = { style = "width: 101px;" },
34 content = function(record)
35 if record.minus2_unfulfilled_count then
36 local max_value = record.initiative.supporter_count
37 ui.bargraph{
38 max_value = max_value,
39 width = 100,
40 bars = {
41 { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count },
42 { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count },
43 { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count},
44 { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count },
45 { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count },
46 }
47 }
48 end
49 end
50 },
51 {
52 content = function(record)
53 ui.link{
54 text = record.name,
55 module = "suggestion",
56 view = "show",
57 id = record.id
58 }
59 local degree
60 local opinion
61 if app.session.member_id then
62 opinion = Opinion:by_pk(app.session.member.id, record.id)
63 end
64 if opinion then
65 local degrees = {
66 ["-2"] = _"must not",
67 ["-1"] = _"should not",
68 ["0"] = _"neutral",
69 ["1"] = _"should",
70 ["2"] = _"must"
71 }
72 slot.put(" &middot; ")
73 ui.tag{ content = degrees[tostring(opinion.degree)] }
74 slot.put(" &middot; ")
75 if opinion.fulfilled then
76 ui.tag{ content = _"implemented" }
77 else
78 ui.tag{ content = _"not implemented" }
79 end
80 end
81 end
82 },
83 }
84 }
85 end
86 end
87 }
88 end }
89 if app.session.member_id
90 and not initiative.issue.half_frozen
91 and not initiative.issue.closed
92 and not initiative.revoked
93 and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id)
94 then
95 ui.container{ attr = { class = "content" }, content = function()
96 ui.link{
97 module = "suggestion", view = "new", params = { initiative_id = initiative.id },
98 text = _"New suggestion"
99 }
100 end }
101 end
102 end
103 }

Impressum / About Us