-
Notifications
You must be signed in to change notification settings - Fork 110
/
index.js
29 lines (27 loc) · 1.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as notifier from '../../utils/notificationHelper';
import getConstant from '../../constants';
import { paginableSelector } from '../../utils/paginable';
$(() => {
$(paginableSelector).on('click, change', '.set_test_plan input[type="checkbox"]', (e) => {
const form = $(e.target).closest('form');
form.submit();
});
$(paginableSelector).on('ajax:success', '.set_test_plan', (e, data) => {
const form = $(e.target);
if (data.code === 1 && data.msg && data.msg !== '') {
notifier.renderNotice(data.msg);
} else {
notifier.renderAlert(data.msg);
}
if (form.find('input[type="checkbox"]').is(':checked')) {
form.parent().siblings('.plan-visibility').html(getConstant('PLAN_VISIBILITY_WHEN_TEST'))
.attr('title', '');
} else {
form.parent().siblings('.plan-visibility').html(getConstant('PLAN_VISIBILITY_WHEN_NOT_TEST'))
.attr('title', getConstant('PLAN_VISIBILITY_WHEN_NOT_TEST_TOOLTIP'));
}
});
$(paginableSelector).on('ajax:error', '.set_test_plan', () => {
// TODO adequate error handling for network error
});
});