Skip to content

Commit afdef15

Browse files
committed
Improving displays with tables instead of concats and OLs
1 parent 6659c6e commit afdef15

File tree

6 files changed

+478
-127
lines changed

6 files changed

+478
-127
lines changed

templates/officer.tmpl

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,66 @@
2222
</div>
2323
<div class="column">
2424
{{with .Officer}}
25-
<p>Officer ID: {{.OfficershipMemberID}}<br>
26-
User: <a href="/internal/user/{{.UserID}}">{{.UserName}}</a><br>
27-
Officership: <a href="/internal/officership/{{.OfficerID}}">{{.OfficershipName}}</a><br>
28-
Team: {{if and .TeamID.Valid .TeamName.Valid}}<a href="/internal/officership/team/{{.TeamID.Int64}}">{{.TeamName.String}}</a>{{else}}UNKNOWN{{end}}<br>
29-
Start date: {{if .StartDate.Valid}}{{formatOfficershipDate .StartDate.Time}}{{else}}UNKNOWN{{end}}<br>
30-
{{if .EndDate.Valid}}
31-
End date: {{formatOfficershipDate .EndDate.Time}}<br>
32-
{{else}}
33-
Incumbent officer<br>
34-
{{end}}
35-
</p>
25+
<table style="border-collapse: collapse; padding-left: 10px;">
26+
<tbody>
27+
<tr style="border: none; padding-bottom: 5px;">
28+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
29+
Officer ID
30+
</td>
31+
<td style="border: none;">
32+
{{.OfficershipMemberID}}
33+
</td>
34+
</tr>
35+
<tr style="border: none; padding-bottom: 5px;">
36+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
37+
User
38+
</td>
39+
<td style="border: none;">
40+
<a href="/internal/user/{{.UserID}}">{{.UserName}}</a>
41+
</td>
42+
</tr>
43+
<tr style="border: none; padding-bottom: 5px;">
44+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
45+
Officership
46+
</td>
47+
<td style="border: none;">
48+
<a href="/internal/officership/{{.OfficerID}}">{{.OfficershipName}}</a>
49+
</td>
50+
</tr>
51+
<tr style="border: none; padding-bottom: 5px;">
52+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
53+
Team
54+
</td>
55+
<td style="border: none;">
56+
{{if and .TeamID.Valid .TeamName.Valid}}<a href="/internal/officership/team/{{.TeamID.Int64}}">{{.TeamName.String}}</a>{{else}}UNKNOWN{{end}}
57+
</td>
58+
</tr>
59+
<tr style="border: none; padding-bottom: 5px;">
60+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
61+
Start date
62+
</td>
63+
<td style="border: none;">
64+
{{if .StartDate.Valid}}{{formatOfficershipDate .StartDate.Time}}{{else}}UNKNOWN{{end}}
65+
</td>
66+
</tr>
67+
{{if .EndDate.Valid}}
68+
<tr style="border: none; padding-bottom: 5px;">
69+
<td style="border: none; padding-right: 20px; padding-bottom: 5px;">
70+
End date
71+
</td>
72+
<td style="border: none;">
73+
{{formatOfficershipDate .EndDate.Time}}
74+
</td>
75+
</tr>
76+
{{else}}
77+
<tr style="border: none; padding-bottom: 5px;">
78+
<td style="border: none;">
79+
Incumbent officer
80+
</td>
81+
</tr>
82+
{{end}}
83+
</tbody>
84+
</table>
3685
{{end}}
3786
</div>
3887
</div>

templates/officershipTeam.tmpl

Lines changed: 88 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,44 +79,104 @@
7979
</div>
8080
<div class="column">
8181
{{with .OfficershipTeam}}
82-
<p>Team ID: {{.TeamID}}<br>
83-
Name: {{.Name}}<br>
84-
Email alias: {{.EmailAlias}}<br><br>
85-
Short description: {{.ShortDescription}}<br><br>
86-
Full description: {{.FullDescription}}
87-
{{if gt (len .TeamMembers) 0}}<br><br>
88-
Officership team members:
89-
<ol>
82+
<table style="border-collapse: collapse; padding-left: 10px;">
83+
<tbody>
84+
<tr style="border: none;">
85+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
86+
Team ID
87+
</td>
88+
<td style="border: none; padding-bottom: 10px;">
89+
{{.TeamID}}
90+
</td>
91+
</tr>
92+
<tr style="border: none;">
93+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
94+
Name
95+
</td>
96+
<td style="border: none; padding-bottom: 10px;">
97+
{{.Name}}
98+
</td>
99+
</tr>
100+
<tr style="border: none;">
101+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
102+
Email alias
103+
</td>
104+
<td style="border: none; padding-bottom: 10px;">
105+
{{.EmailAlias}}
106+
</td>
107+
</tr>
108+
<tr style="border: none;">
109+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
110+
Short description
111+
</td>
112+
<td style="border: none; padding-bottom: 10px;">
113+
{{.ShortDescription}}
114+
</td>
115+
</tr>
116+
<tr style="border: none;">
117+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
118+
Full Description
119+
</td>
120+
<td style="border: none; padding-bottom: 10px;">
121+
{{.FullDescription}}
122+
</td>
123+
</tr>
124+
</tbody>
125+
</table>
126+
{{if gt (len .TeamMembers) 0}}<br>
127+
<table style="border-collapse: collapse; width: 100%;">
128+
<tbody>
129+
<tr style="border: none;">
130+
<th colspan="3" style="padding: 10px 0 10px 0;">
131+
Officership team members
132+
</th>
133+
</tr>
90134
{{range .TeamMembers}}
91135
{{if .IsCurrent}}
92-
<li style='list-style-type: none;'><span class='tab'></span>
93-
<a href="/internal/officership/{{.OfficerID}}">{{.OfficerName}}</a>{{if .IsLeader}} - Leader{{else if .IsDeputy}}
94-
- Deputy{{end}}&emsp;<a
95-
class="button is-danger is-outlined"
96-
onclick="removeOfficershipFromTeamModal({{.OfficerID}}, '{{.OfficerName}}')">Remove
97-
officership</a>
98-
</li>
136+
<tr style="border: none;">
137+
<td style="border: none; padding-left: 2em;">
138+
<a href="/internal/officership/{{.OfficerID}}">{{.OfficerName}}</a>
139+
</td>
140+
<td style="border: none;">
141+
{{if .IsLeader}}Leader{{else if .IsDeputy}}Deputy{{end}}
142+
</td>
143+
<td style="border: none;">
144+
<a class="button is-danger is-outlined"
145+
onclick="removeOfficershipFromTeamModal({{.OfficerID}}, '{{.OfficerName}}')">
146+
Remove officership
147+
</a>
148+
</td>
149+
</tr>
99150
{{end}}
100151
{{end}}
101-
</ol><br>
102-
Retired officership team members:
103-
<ol>
152+
<tr style="border: none;">
153+
<th colspan="3" style="padding: 10px 0 10px 0;">
154+
Retired officership team members
155+
</th>
156+
</tr>
104157
{{range .TeamMembers}}
105158
{{if not .IsCurrent}}
106-
<li style='list-style-type: none;'><span class='tab'></span>
107-
<a href="/internal/officership/{{.OfficerID}}">{{.OfficerName}}</a>{{if .IsLeader}} - was leader{{else if .IsDeputy}}
108-
- was deputy{{end}}&emsp;<a
109-
class="button is-danger is-outlined"
110-
onclick="removeOfficershipFromTeamModal({{.OfficerID}}, '{{.OfficerName}}')">Remove
111-
officership</a>
112-
</li>
159+
<tr style="border: none;">
160+
<td style="border: none; padding-left: 2em;">
161+
<a href="/internal/officership/{{.OfficerID}}">{{.OfficerName}}</a>
162+
</td>
163+
<td style="border: none;">
164+
{{if .IsLeader}}was leader{{else if .IsDeputy}}was deputy{{end}}
165+
</td>
166+
<td style="border: none;">
167+
<a class="button is-danger is-outlined"
168+
onclick="removeOfficershipFromTeamModal({{.OfficerID}}, '{{.OfficerName}}')">
169+
Remove officership
170+
</a>
171+
</td>
172+
</tr>
113173
{{end}}
114174
{{end}}
115-
</ol>
175+
</tbody>
176+
</table>
116177
{{end}}
117-
</p>
118178
{{if gt (len .OfficershipsNotInTeam) 0}}
119-
Use the drop down below to add more officerships to this team.<br>
179+
<p>Use the drop down below to add more officerships to this team.</p><br>
120180
<form method="post" action="/internal/officership/team/{{.TeamID}}/officership/add">
121181
<div class="field">
122182
<label class="label" for="officership">Officership</label>

templates/permission.tmpl

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,56 @@
2525
<div class="column">
2626
{{$roleAdmin := checkPermission .UserPermissions "ManageMembers.Group"}}
2727
{{with .Permission}}
28-
<p>Permission ID: {{.PermissionID}}<br>
29-
Name: {{.Name}}<br>
30-
Description: {{.Description}}{{if gt (len .Roles) 0}}<br><br>
31-
Inherited by: <ol>
32-
{{range .Roles}}
33-
<li style='list-style-type: none;'><span class='tab'></span>
34-
{{if $roleAdmin}}
35-
<a href="/internal/role/{{.RoleID}}">{{.Name}}</a>
36-
{{else}}
37-
{{.Name}}
38-
{{end}}
39-
</li>
28+
<table style="border-collapse: collapse; padding-left: 10px;">
29+
<tbody>
30+
<tr style="border: none;">
31+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
32+
Permission ID
33+
</td>
34+
<td style="border: none; padding-bottom: 10px;">
35+
{{.PermissionID}}
36+
</td>
37+
</tr>
38+
<tr style="border: none;">
39+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
40+
Name
41+
</td>
42+
<td style="border: none; padding-bottom: 10px;">
43+
{{.Name}}
44+
</td>
45+
</tr>
46+
<tr style="border: none;">
47+
<td style="border: none; padding-right: 20px; padding-bottom: 10px;">
48+
Description
49+
</td>
50+
<td style="border: none; padding-bottom: 10px;">
51+
{{.Description}}
52+
</td>
53+
</tr>
54+
</tbody>
55+
</table>
56+
<table style="border-collapse: collapse; width: 100%;">
57+
<tbody>
58+
{{if gt (len .Roles) 0}}
59+
<tr style="border: none;">
60+
<th colspan="2" style="padding: 10px 0 10px 0;">
61+
Permissions
62+
</th>
63+
</tr>
64+
{{range .Roles}}
65+
<tr style="border: none;">
66+
{{if $roleAdmin}}
67+
<td style="border: none; padding-left: 2em;">
68+
<a href="/internal/role/{{.RoleID}}">{{.Name}}</a>
69+
</td>
70+
{{else}}
71+
{{.Name}}
72+
{{end}}
73+
</tr>
74+
{{end}}
4075
{{end}}
41-
</ol>
42-
{{end}}
43-
</p>
76+
</tbody>
77+
</table>
4478
{{end}}
4579
</div>
4680
</div>
@@ -108,7 +142,9 @@
108142
/>
109143
</div>
110144
</div>
111-
<button class="button is-danger"><span class="mdi mdi-pencil"></span>&ensp;Edit permission</button>
145+
<button class="button is-danger"><span class="mdi mdi-pencil"></span>&ensp;Edit
146+
permission
147+
</button>
112148
</form>
113149
</div>
114150
</div>
@@ -126,10 +162,13 @@
126162
<div class="content">
127163
<p class="title">Are you sure you want to delete this permission?</p>
128164
<p><strong>This can be undone{{if eq .Permission.Name "SuperUser"}}<br>
129-
Be very careful, this is the most powerful permission and will break many, many things!<br>
130-
{{end}}</strong></p>
165+
Be very careful, this is the most powerful permission and will break many, many things!
166+
<br>
167+
{{end}}</strong></p>
131168
<form action="/internal/permission/{{.Permission.PermissionID}}/delete" method="post">
132-
<button class="button is-danger"><span class="mdi mdi-key-remove"></span>&ensp;Delete permission</button>
169+
<button class="button is-danger"><span class="mdi mdi-key-remove"></span>&ensp;Delete
170+
permission
171+
</button>
133172
</form>
134173
</div>
135174
</div>

0 commit comments

Comments
 (0)