Skip to content

Commit 7a96373

Browse files
committed
Fix voting page for updated election process
1 parent f04da79 commit 7a96373

File tree

3 files changed

+20
-305
lines changed

3 files changed

+20
-305
lines changed

ballot.html

Lines changed: 7 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10,70 +10,17 @@
1010

1111
between 00:00:00UTC on October 8th and 23:59:59UTC on October 20th.
1212

13-
Section 1: Staff Rankings
13+
1. Please select exactly EIGHT (8) members to serve as the NOC.
1414

15-
Please rank all staff from 1-{{count}}.
15+
2. Choose either ZERO (0) or ONE (1) member of staff to nominate for
16+
removal.
1617

17-
- You may want to use https://www.oftc.net/voting/ to make it easier to
18-
vote. If you don't, read the following rules:
19-
- Do NOT use the same number twice;
20-
- Either completely fill out the ranks or do not fill them out at all; a
21-
partially filled ballot cannot be counted accurately and will be
22-
discarded;
23-
- Check as many Ombudsman boxes as you would like. The individual with the
24-
most checks will be the Ombudsman;
25-
- Check as many Remove boxes as you'd like. More than half of all votes
26-
must have an individual's Remove box checked in order for that
27-
individual to be dismissed;
28-
- (S) denotes people who sponsor servers among their roles; Removing
29-
a sponsor will mean we delink their servers also.
30-
- The breakdown of the results will be as follows:
31-
32-
1 Chair
33-
1-8 NOC
34-
9-16 Network Operators
35-
17-{{count}} Network Representatives
36-
37-
Rank Name Nick Sponsor Ombudsman Remove
38-
------+------------------------+------------+---------+-----------+--------
18+
Name Nick NOC Remove
19+
------------------------+------------+-----------+--------
3920
{{#staff}}
40-
{{rank}} {{name}} {{nick}} {{sponsor}} {{ombudsman}} {{remove}}
21+
{{name}} {{nick}} {{noc}} {{remove}}
4122
{{/staff}}
4223

43-
Section 2: Sponsors
44-
45-
The following sponsors have not decided to compete for a staff position
46-
other than sponsor. Should you want them removed from staff please
47-
indicate that by checking the remove box.
48-
49-
- Check as many Remove boxes as you'd like. More than half of all votes
50-
must have an individual's Remove box checked in order for that
51-
individual to be dismissed; Removing a sponsor will mean we delink
52-
their servers.
53-
54-
Rank Name Nick Sponsor Remove
55-
------+------------------------+------------+---------+--------
56-
{{#sponsors}}
57-
{{name}} {{nick}} {{sponsor}} {{remove}}
58-
{{/sponsors}}
59-
60-
Section 3: Do you agree with the following people being Advisors?
61-
Not answering will be counted as a "Yes". Please ensure that
62-
if you object, you write "No".
63-
64-
Yes/No Name Nick Role
65-
--------+----------------------+------------+---------
66-
{{advisor0}} David Graham cdlu Advisor
67-
{{advisor1}} Timothy J. Fontaine tjfontaine Advisor
68-
69-
70-
Section 4: Yes/No questions. Unanswered questions will be counted as a
71-
"Yes", so please ensure that if you object, you write "No".
72-
73-
Yes/No Issue
74-
{{spi}} Should OFTC remain a member project of Software in the
75-
Public Interest?
76-
77-
-=-=-=-=-=-=-=-=-=-=- Do not delete this line -=-=-=-=-=-=-=-=-=-=-
24+
-=-=-=-=-=-=-=-=-=-=- Do not delete this line -=-=-=-=-=-=-=-=-=-=-
7825
</textarea>
7926
{% endraw %}

js/voting.js

Lines changed: 11 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
var staffJSON = {};
2-
var sponsorsJSON = {};
32
var staff = {
43
'staff': [],
5-
'sponsors': [],
6-
'advisor0': '',
7-
'advisor1': '',
8-
'spi': ''
94
};
105
$(document).ready(function() {
116
var templateFields = {
127
'nick': '%-12s',
138
'name': '%-24s',
14-
'rank': '%\'_4s',
15-
'sponsor': '%-9s',
16-
'ombudsman': '%-11s',
9+
'noc': '%-11s',
1710
'remove': '%-8s',
18-
'yn': '%-3s'
1911
};
2012

2113
function formatField(field, data)
@@ -32,21 +24,7 @@ $(document).ready(function() {
3224

3325
data['nick'] = formatField('nick', item['nick']);
3426
data['name'] = formatField('name', item['name']);
35-
data['rank'] = formatField('rank', item['rank']);
36-
data['sponsor'] = formatField('sponsor', item['roles'].sponsor ? '(S)' : '');
37-
data['ombudsman'] = formatField('ombudsman', item['ombudsman'] ? '[X]' : '[ ]');
38-
data['remove'] = formatField('remove', item['remove'] ? '[X]' : '[ ]');
39-
40-
return data;
41-
}
42-
43-
function formatSponsors(item)
44-
{
45-
var data = {};
46-
47-
data['nick'] = formatField('nick', item['nick']);
48-
data['name'] = formatField('name', item['name']);
49-
data['sponsor'] = formatField('sponsor', item['roles'].sponsor ? '(S)' : '');
27+
data['noc'] = formatField('noc', item['noc'] ? '[X]' : '[ ]');
5028
data['remove'] = formatField('remove', item['remove'] ? '[X]' : '[ ]');
5129

5230
return data;
@@ -64,7 +42,7 @@ $(document).ready(function() {
6442
.done(function(data)
6543
{
6644
staffJSON = data;
67-
$.each(staffJSON['staff'], function(i, item)
45+
$.each(staffJSON, function(i, item)
6846
{
6947
staff.staff.push(formatStaff(item));
7048
});
@@ -73,89 +51,14 @@ $(document).ready(function() {
7351
{
7452
var newRow = $('<tr class="item">').appendTo('#members');
7553

76-
var col = $('<td class="index">').appendTo(newRow);
77-
col.append(i + 1)
78-
col = $('<td>').appendTo(newRow);
79-
col.append('<i class="handle bi-arrows-vertical">');
80-
AddCol(newRow, { value: item['name'].trim() });
81-
AddCol(newRow, { class: 'nick', value: item['nick'].trim() });
82-
AddCol(newRow, { type: 'checkbox', name: 'sponsor', checked: item['sponsor'].trim() !== '' ? 'checked' : null, disabled: 'disabled' });
83-
AddCol(newRow, { class: 'ombudsman', type: 'checkbox', name: 'ombudsman' });
84-
AddCol(newRow, { class: 'remove', type: 'checkbox', name: 'remove' });
85-
});
86-
});
87-
88-
$.getJSON('/sponsors.json', function()
89-
{
90-
})
91-
.error(function()
92-
{
93-
alert('error getting sponsors.json');
94-
})
95-
.done(function(data)
96-
{
97-
sponsorsJSON = data;
98-
sponsorsJSON['contacts']= {};
99-
100-
$.each(sponsorsJSON['sponsors'], function(i, item)
101-
{
102-
$.each(item['contact'], function(i, item)
103-
{
104-
if(staffJSON['staff'][i] === undefined) {
105-
sponsorsJSON['contacts'][i] = item;
106-
}
107-
});
108-
});
109-
$.each(sponsorsJSON['contacts'], function(i, item)
110-
{
111-
staff.sponsors.push(formatSponsors(item));
112-
});
113-
114-
$.each(staff['sponsors'], function(i, item)
115-
{
116-
var newRow = $('<tr class="item">').appendTo('#sponsors');
117-
var checked;
118-
11954
AddCol(newRow, { value: item['name'].trim() });
12055
AddCol(newRow, { class: 'nick', value: item['nick'].trim() });
121-
checked = item['sponsor'].trim() !== '' ? 'checked' : null;
122-
AddCol(newRow, { type: 'checkbox', name: 'sponsor', checked: checked, disabled: 'disabled' });
56+
AddCol(newRow, { class: 'noc', type: 'checkbox', name: 'noc' });
12357
AddCol(newRow, { class: 'remove', type: 'checkbox', name: 'remove' });
12458
});
125-
126-
randomizeList();
127-
updateIndex();
12859
});
12960
}
13061

131-
function randomizeList()
132-
{
133-
function swap(a, b)
134-
{
135-
var ac = $(a).clone(true);
136-
var bc = $(b).clone(true);
137-
$(a).replaceWith(bc);
138-
$(b).replaceWith(ac);
139-
}
140-
141-
var table
142-
var list;
143-
144-
table = $('#members tbody');
145-
list = $('tr', table);
146-
147-
for(i = 0; i < list.length; i++)
148-
{
149-
j = Math.floor(Math.random() * i);
150-
if(i != j)
151-
{
152-
swap(list[i], list[j]);
153-
// Update the list to avoid stale references.
154-
list = $('tr', table);
155-
}
156-
}
157-
}
158-
15962
ProcessJSON();
16063

16164
function AddCol(row, attr)
@@ -179,49 +82,16 @@ $(document).ready(function() {
17982
row.append(td);
18083
}
18184

182-
updateIndex = function()
183-
{
184-
$('#members tbody tr td.index').each(function(i)
185-
{
186-
$(this).html(i + 1);
187-
});
188-
};
189-
190-
$('#members tbody').sortable(
191-
{
192-
handle: '.handle',
193-
helper: function(e, tr)
194-
{
195-
var originals = tr.children();
196-
var helper = tr.clone();
197-
198-
helper.children().each(function(index)
199-
{
200-
$(this).width(originals.eq(index).width());
201-
});
202-
return helper;
203-
},
204-
stop: updateIndex
205-
});
206-
20785
$('#rawballot').click(function()
20886
{
20987
$.get('/ballot', function(tmpl)
21088
{
21189
staff['count'] = Object.keys(staff['staff']).length;
21290
$.each(staff['staff'], function(i, item)
21391
{
214-
item['rank'] = formatField('rank', '');
215-
item['ombudsman'] = formatField('ombudsman', '[ ]');
92+
item['noc'] = formatField('noc', '[ ]');
21693
item['remove'] = formatField('remove', '[ ]');
21794
});
218-
$.each(staff['sponsors'], function(i, item)
219-
{
220-
item['remove'] = formatField('remove', '[ ]');
221-
});
222-
staff['advisor0'] = formatField('yn', '');
223-
staff['advisor1'] = formatField('yn', '');
224-
staff['spi'] = formatField('yn', '');
22595
var ballot = Hogan.compile(tmpl);
22696
$('#overlay-content').html(ballot.render(staff));
22797
$('#overlay').modal({ keyboard: true });
@@ -230,53 +100,25 @@ $(document).ready(function() {
230100

231101
$('#submit').click(function()
232102
{
233-
// Section 1
234-
staff['count'] = Object.keys(staff['staff']).length;
103+
104+
// Selections
235105
$('#members tr.item').each(function(i, row)
236106
{
237107
var key = $('span.nick', row).text();
238-
var rank = $('td.index', row).text();
239-
var ombudsman = $('input.ombudsman', row)[0].checked;
108+
var noc = $('input.noc', row)[0].checked;
240109
var remove = $('input.remove', row)[0].checked;
241110

242-
staffJSON['staff'][key].rank = rank;
243-
staffJSON['staff'][key].ombudsman = ombudsman;
244-
staffJSON['staff'][key].remove = remove;
111+
staffJSON[i].noc = noc;
112+
staffJSON[i].remove = remove;
245113
});
246114

247115
staff.staff = [];
248116

249-
$.each(staffJSON['staff'], function(i, item)
117+
$.each(staffJSON, function(i, item)
250118
{
251119
staff.staff.push(formatStaff(item));
252120
});
253121

254-
// Section 2
255-
$('#sponsors tr.item').each(function(i, row)
256-
{
257-
var key = $('span.nick', row).text();
258-
var remove = $('input.remove', row)[0].checked;
259-
260-
sponsorsJSON['contacts'][key].remove = remove;
261-
});
262-
263-
staff.sponsors = [];
264-
265-
$.each(sponsorsJSON['contacts'], function(i, item)
266-
{
267-
staff.sponsors.push(formatSponsors(item));
268-
});
269-
270-
// Section 3
271-
var advisor0 = $('#advisor0').val();
272-
staff.advisor0 = formatField('yn', advisor0);
273-
var advisor1 = $('#advisor1').val();
274-
staff.advisor1 = formatField('yn', advisor1);
275-
276-
// Section 4
277-
var spi = $('#question0').val();
278-
staff.spi = formatField('yn', spi);
279-
280122
$.get('/ballot', function (tmpl)
281123
{
282124
var ballot = Hogan.compile(tmpl);

0 commit comments

Comments
 (0)