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