Skip to content

Commit 38ef364

Browse files
authored
Merge pull request #88 from 0x7fffffff/mick
moar fixes
2 parents 75ae4af + 9bf5f38 commit 38ef364

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

static/js/account.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,26 @@ function addAdmin(admin) {
2121

2222
row.append('<th class="col-md-1 col-lg-1 col-xl-1 row-number" scope=row>0</th>');
2323
row.append('<td class="col-md-10 col-lg-10 col-xl-10">' + admin.Handle + '</td>');
24-
row.append('<td class="col-md-1 col-lg-1 col-xl-1">' + makeDeleteButton() + '</td>');
24+
var deleteButton = $(makeDeleteButton());
25+
var deleteColumn = $('<td class="col-md-1 col-lg-1 col-xl-1"></td>');
26+
deleteColumn.append(deleteButton);
27+
row.append(deleteColumn);
2528

2629
var wrapper = $('#admin-list-wrapper');
2730
if (wrapper.is(':hidden')) {
2831
$('#admin-selection-table > tbody').append(row);
2932

3033
recountAdmins();
31-
addDeleteAdminListener();
32-
3334
wrapper.show('slow');
3435
$('#admin-list-header').show('slow');
3536
} else {
3637
row.hide();
3738
row.appendTo('#admin-selection-table > tbody').show('fast');
3839

3940
recountAdmins();
40-
addDeleteAdminListener();
4141
}
42+
43+
addDeleteHandler($(deleteButton.find('.delete-button')));
4244
};
4345

4446
function addHandleChangeListener() {
@@ -164,7 +166,11 @@ function addPasswordChangeListener() {
164166
};
165167

166168
function addDeleteAdminListener() {
167-
$('.delete-button').click(function(event) {
169+
addDeleteHandler($('.delete-button'));
170+
};
171+
172+
function addDeleteHandler(object) {
173+
object.click(function(event) {
168174
event.stopPropagation();
169175
event.preventDefault();
170176

@@ -186,11 +192,13 @@ function addDeleteAdminListener() {
186192
if (count <= 1) {
187193
$('#admin-list-header').hide('400');
188194
$('#admin-list-wrapper').hide('400', function() {
189-
row.remove();
195+
row.remove();
196+
recountAdmins();
190197
});
191198
} else {
192199
row.hide('fast', function() {
193-
this.remove();
200+
this.remove();
201+
recountAdmins();
194202
});
195203
}
196204
}).fail(alertAjaxFailure);

static/js/networks.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function changeCaptionerState(captioner, state) {
175175
var row = $(document.getElementById(tableId));
176176
row.hide('slow', function() {
177177
this.remove();
178+
recountCaptioners();
178179
});
179180
} else if (state === 2) { // muted
180181
var row = $(document.getElementById(tableId));
@@ -232,7 +233,7 @@ function recountEncoders() {
232233
var body = $('#encoder-selection-table > tbody');
233234
var rows = body.children('tr');
234235

235-
$('#encoder-count').text(rows.length);
236+
$('#encoder-count').text(rows.length + '');
236237
rows.each(function(index, el) {
237238
$(el).children('.row-number').text((index + 1) + '');
238239
});
@@ -259,12 +260,10 @@ function addEncoder(encoder) {
259260
'</td>');
260261

261262
var disconnectItem = $('<td class="encoder-connect-row">' + makeDisconnectButton() + '</td>');
262-
263263
var count = body.children().length;
264-
265264
var row = $('<tr class="encoder-row" data-encoder-id="' + encoder.ID + '"></tr>');
266265

267-
row.append('<th scope=row>' + (count + 1) + '</th>');
266+
row.append('<th class="row-number" scope=row>' + (count + 1) + '</th>');
268267
row.append('<td class="editable" data-name="name" name="name">' + encoder.Name + '</td>');
269268
row.append('<td class="editable" data-name="ip_address" name="ip_address">' + encoder.IPAddress + '</td>');
270269
row.append('<td class="editable" data-name="port" name="port">' + encoder.Port + '</td>');

templates/_network.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h3>Connected Encoders</h3>
9191
<tbody>
9292
{{range $index, $element := .Encoders }}
9393
<tr class="encoder-row" data-encoder-id="{{ $element.ID }}">
94-
<th scope=row>
94+
<th class="row-number" scope=row>
9595
{{ inc $index }}
9696
</th>
9797

0 commit comments

Comments
 (0)