Skip to content

Commit 6c8a85a

Browse files
committed
[qa] Switched to prettier for CSS/JS formatting
1 parent 072ced9 commit 6c8a85a

File tree

6 files changed

+91
-126
lines changed

6 files changed

+91
-126
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
id: deps
5454
run: |
5555
pip install -U pip setuptools wheel
56-
sudo npm install -g jslint
56+
sudo npm install -g prettier
5757
pip install -U -r requirements-test.txt
5858
pip install -U -e .
5959
pip install ${{ matrix.django-version }}

.jslintrc

-49
This file was deleted.

django_x509/static/django-x509/css/admin.css

+17-11
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44
.field-private_key p,
55
.field-private_key div.readonly,
66
.field-private_key .vLargeTextField,
7-
pre.x509{
8-
font-family: monospace;
9-
white-space: pre;
7+
pre.x509 {
8+
font-family: monospace;
9+
white-space: pre;
1010
}
1111
.field-certificate .vLargeTextField,
12-
.field-private_key .vLargeTextField{
13-
height: 350px;
12+
.field-private_key .vLargeTextField {
13+
height: 350px;
1414
}
1515
.field-certificate p.help,
16-
.field-private_key p.help{
17-
font-family: inherit;
18-
white-space: normal;
16+
.field-private_key p.help {
17+
font-family: inherit;
18+
white-space: normal;
19+
}
20+
fieldset.x509-custom {
21+
margin-top: 0;
22+
}
23+
fieldset.x509-custom .form-row {
24+
padding: 0;
25+
}
26+
fieldset.x509-custom pre {
27+
margin-top: 0;
1928
}
20-
fieldset.x509-custom { margin-top: 0 }
21-
fieldset.x509-custom .form-row{ padding: 0 }
22-
fieldset.x509-custom pre{ margin-top: 0 }
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
input[type="submit"] {
2-
background: #ba2121;
3-
border-radius: 4px;
4-
padding: 10px 15px;
5-
color: #fff;
2+
background: #ba2121;
3+
border-radius: 4px;
4+
padding: 10px 15px;
5+
color: #fff;
66
}
77
a.cancel-link {
8-
display: inline-block;
9-
vertical-align: middle;
10-
height: 15px;
11-
line-height: 15px;
12-
background: #ddd;
13-
border-radius: 4px;
14-
padding: 10px 15px;
15-
color: #333;
16-
margin: 0 0 0 10px;
8+
display: inline-block;
9+
vertical-align: middle;
10+
height: 15px;
11+
line-height: 15px;
12+
background: #ddd;
13+
border-radius: 4px;
14+
padding: 10px 15px;
15+
color: #333;
16+
margin: 0 0 0 10px;
1717
}
1818
a.cancel-link:hover {
19-
background-color: #ddd;
19+
background-color: #ddd;
2020
}
2121
input[type="submit"]:hover {
22-
background-color: #ba2121;
22+
background-color: #ba2121;
2323
}
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,60 @@
11
django.jQuery(function ($) {
2-
'use strict';
3-
// select private_key/certificate field text on click
4-
$('.field-certificate, .field-private_key').find(".readonly").on('click', function () {
5-
var range, selection;
6-
if (window.getSelection) {
7-
selection = window.getSelection();
8-
range = document.createRange();
9-
range.selectNodeContents(this);
10-
selection.removeAllRanges();
11-
selection.addRange(range);
12-
} else if (document.body.createTextRange) {
13-
range = document.body.createTextRange();
14-
range.moveToElementText(this);
15-
range.select();
16-
}
2+
"use strict";
3+
// select private_key/certificate field text on click
4+
$(".field-certificate, .field-private_key")
5+
.find(".readonly")
6+
.on("click", function () {
7+
var range, selection;
8+
if (window.getSelection) {
9+
selection = window.getSelection();
10+
range = document.createRange();
11+
range.selectNodeContents(this);
12+
selection.removeAllRanges();
13+
selection.addRange(range);
14+
} else if (document.body.createTextRange) {
15+
range = document.body.createTextRange();
16+
range.moveToElementText(this);
17+
range.select();
18+
}
1719
});
18-
var changePopupPage = new RegExp(/\d\/change\/\?/);
19-
var url = window.location.href;
20-
var operationType = $('.field-operation_type select');
21-
// enable switcher only in add forms
22-
if (!operationType.length || $('form .deletelink-box').length > 0 || changePopupPage.test(url)) {
23-
$('.field-operation_type').hide();
24-
return;
20+
var changePopupPage = new RegExp(/\d\/change\/\?/);
21+
var url = window.location.href;
22+
var operationType = $(".field-operation_type select");
23+
// enable switcher only in add forms
24+
if (
25+
!operationType.length ||
26+
$("form .deletelink-box").length > 0 ||
27+
changePopupPage.test(url)
28+
) {
29+
$(".field-operation_type").hide();
30+
return;
31+
}
32+
// function for operation_type switcher
33+
var showFields = function () {
34+
// define fields for each operation
35+
var importFields = $(
36+
".form-row:not(.field-certificate, .field-operation_type, " +
37+
".field-private_key, .field-name, .field-ca, .field-passphrase)",
38+
),
39+
newFields = $(".form-row:not(.field-certificate, .field-private_key)"),
40+
defaultFields = $(".form-row:not(.field-operation_type)"),
41+
allFields = $(".form-row"),
42+
value = operationType.val();
43+
if (value === "-") {
44+
allFields.show();
45+
defaultFields.hide();
2546
}
26-
// function for operation_type switcher
27-
var showFields = function () {
28-
// define fields for each operation
29-
var importFields = $('.form-row:not(.field-certificate, .field-operation_type, ' +
30-
'.field-private_key, .field-name, .field-ca, .field-passphrase)'),
31-
newFields = $('.form-row:not(.field-certificate, .field-private_key)'),
32-
defaultFields = $('.form-row:not(.field-operation_type)'),
33-
allFields = $('.form-row'),
34-
value = operationType.val();
35-
if (value === '-') {
36-
allFields.show();
37-
defaultFields.hide();
38-
}
39-
if (value === 'new') {
40-
allFields.hide();
41-
newFields.show();
42-
}
43-
if (value === 'import') {
44-
allFields.show();
45-
importFields.hide();
46-
}
47-
};
47+
if (value === "new") {
48+
allFields.hide();
49+
newFields.show();
50+
}
51+
if (value === "import") {
52+
allFields.show();
53+
importFields.hide();
54+
}
55+
};
56+
showFields();
57+
operationType.on("change", function (e) {
4858
showFields();
49-
operationType.on('change', function (e) {
50-
showFields();
51-
});
59+
});
5260
});

run-qa-checks

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
set -e
44

5-
jslint django_x509/static/django-x509/js/*.js
6-
75
openwisp-qa-check --migrations-to-ignore 4 \
86
--migration-path ./django_x509/migrations/ \
9-
--migration-module django_x509
7+
--migration-module django_x509 \
8+
--csslinter \
9+
--jslinter
1010

1111
echo ''
1212
echo 'Running checks for SAMPLE_APP'

0 commit comments

Comments
 (0)