rev |
line source |
bsw/jbe@1309
|
1 local unit_id = config.single_unit_id or tonumber(request.get_param{ name = "unit" })
|
bsw/jbe@1309
|
2 if unit_id == "all" then
|
bsw/jbe@1309
|
3 unit_id = nil
|
bsw/jbe@1309
|
4 end
|
bsw/jbe@1309
|
5 local unit
|
bsw/jbe@1309
|
6 if unit_id then
|
bsw/jbe@1309
|
7 unit = Unit:by_id(unit_id)
|
bsw/jbe@1309
|
8 end
|
bsw/jbe@1309
|
9 local area_id = config.single_area_id or tonumber(request.get_param{ name = "area" })
|
bsw/jbe@1309
|
10 if area_id == "all" then
|
bsw/jbe@1309
|
11 area_id = nil
|
bsw/jbe@1309
|
12 end
|
bsw/jbe@1309
|
13 local area
|
bsw/jbe@1309
|
14 if area_id then
|
bsw/jbe@1309
|
15 area = Area:by_id(area_id)
|
bsw/jbe@1309
|
16 end
|
bsw@1596
|
17 if area then
|
bsw/jbe@1309
|
18 if app.session.member_id then
|
bsw/jbe@1309
|
19 area:load_delegation_info_once_for_member_id(app.session.member_id)
|
bsw/jbe@1309
|
20 end
|
bsw/jbe@1309
|
21
|
bsw/jbe@1309
|
22 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw/jbe@1309
|
23 if unit then
|
bsw/jbe@1309
|
24 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
25 if not config.single_area_id then
|
bsw@1596
|
26 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name .. " ยป " .. area.name }
|
bsw/jbe@1309
|
27 else
|
bsw/jbe@1309
|
28 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
|
bsw/jbe@1309
|
29 end
|
bsw/jbe@1309
|
30 end }
|
bsw/jbe@1309
|
31 end
|
bsw/jbe@1309
|
32 if area.description and #(area.description) > 0 then
|
bsw/jbe@1309
|
33 if not config.single_area_id then
|
bsw/jbe@1309
|
34 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = area.description }
|
bsw/jbe@1309
|
35 else
|
bsw/jbe@1309
|
36 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = unit.description }
|
bsw/jbe@1309
|
37 end
|
bsw/jbe@1309
|
38 end
|
bsw/jbe@1309
|
39 if not (config.voting_only and config.disable_delegations) and app.session.member_id then
|
bsw/jbe@1309
|
40 ui.container{ attr = { class = "mdl-card__actions" }, content = function()
|
bsw/jbe@1309
|
41
|
bsw@1596
|
42 if not config.disable_delegations then
|
bsw@1596
|
43
|
bsw/jbe@1309
|
44 if area.delegation_info.first_trustee_id then
|
bsw@1596
|
45 local member = Member:by_id(area.delegation_info.first_trustee_id)
|
bsw@1596
|
46 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
|
bsw@1596
|
47 execute.view{
|
bsw@1596
|
48 module = "member",
|
bsw@1596
|
49 view = "_show_thumb",
|
bsw@1596
|
50 params = {
|
bsw@1596
|
51 member = member
|
bsw/jbe@1309
|
52 }
|
bsw@1596
|
53 }
|
bsw/jbe@1309
|
54 end
|
bsw@1596
|
55
|
bsw@1596
|
56 local text
|
bsw@1596
|
57 if area.delegation_info.own_delegation_scope == nil then
|
bsw@1596
|
58 text = _"delegate..."
|
bsw@1596
|
59 else
|
bsw@1596
|
60 text = _"change delegation..."
|
bsw@1596
|
61 end
|
bsw@1596
|
62
|
bsw@1596
|
63
|
bsw@1596
|
64 ui.tag{ attr = { id = "change_delegation", class = "mdl-button" }, content = text }
|
bsw/jbe@1309
|
65
|
bsw@1596
|
66
|
bsw@1596
|
67 ui.tag { tag = "ul", attr = { class = "mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect", ["for"] = "change_delegation" }, content = function()
|
bsw@1596
|
68
|
bsw@1596
|
69 ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function()
|
bsw/jbe@1309
|
70 ui.link {
|
bsw@1596
|
71 attr = { class = "mdl-menu__link" },
|
bsw/jbe@1309
|
72 module = "delegation", view = "show", params = {
|
bsw/jbe@1309
|
73 unit_id = area.unit_id,
|
bsw/jbe@1309
|
74 },
|
bsw@1596
|
75 content = _("unit: #{name}", { name = area.unit.name })
|
bsw/jbe@1309
|
76 }
|
bsw@1596
|
77 end }
|
bsw@1596
|
78
|
bsw@1596
|
79 ui.tag{ tag = "li", attr = { class = "mdl-menu__item" }, content = function()
|
bsw/jbe@1309
|
80 ui.link {
|
bsw@1596
|
81 attr = { class = "mdl-menu__link" },
|
bsw/jbe@1309
|
82 module = "delegation", view = "show", params = {
|
bsw/jbe@1309
|
83 area_id = area.id
|
bsw/jbe@1309
|
84 },
|
bsw@1596
|
85 content = _("subject area: #{name}", { name = area.name })
|
bsw/jbe@1309
|
86 }
|
bsw@1596
|
87 end }
|
bsw@1596
|
88 end }
|
bsw/jbe@1309
|
89 end
|
bsw@1596
|
90
|
bsw/jbe@1309
|
91 if not config.voting_only and app.session.member_id and app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
|
bsw/jbe@1309
|
92 ui.link {
|
bsw/jbe@1309
|
93 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
|
bsw@1496
|
94 module = "draft", view = "new",
|
bsw/jbe@1309
|
95 params = { area_id = area.id },
|
bsw/jbe@1309
|
96 content = function()
|
bsw/jbe@1309
|
97 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" }
|
bsw/jbe@1309
|
98 ui.tag{ content = _"new issue" }
|
bsw/jbe@1309
|
99 end
|
bsw/jbe@1309
|
100 }
|
bsw/jbe@1309
|
101 end
|
bsw/jbe@1309
|
102 end }
|
bsw/jbe@1309
|
103 end
|
bsw/jbe@1309
|
104 end }
|
bsw/jbe@1309
|
105 elseif unit then
|
bsw/jbe@1309
|
106 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw/jbe@1309
|
107 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
108 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
|
bsw/jbe@1309
|
109 end }
|
bsw/jbe@1309
|
110 if unit.description and #(unit.description) > 0 then
|
bsw/jbe@1309
|
111 ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = unit.description }
|
bsw/jbe@1309
|
112 end
|
bsw@1532
|
113 if config.render_external_reference_unit then
|
bsw@1532
|
114 config.render_external_reference_unit(unit)
|
bsw@1532
|
115 end
|
bsw/jbe@1309
|
116 --ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
|
bsw/jbe@1309
|
117 --end }
|
bsw/jbe@1309
|
118 end }
|
bsw@1489
|
119 else
|
bsw@1489
|
120 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw@1489
|
121 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1489
|
122 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"All issues" }
|
bsw@1489
|
123 end }
|
bsw@1489
|
124 ui.container{ attr = { class = "mdl-card__supporting-text mdl-card--border" }, content = _"All issues in your units. Use filters above to limit results." }
|
bsw@1489
|
125 end }
|
bsw/jbe@1309
|
126 end
|
bsw/jbe@1309
|
127
|