Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qa] Switched to prettier for CSS/JS formatting #172

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
id: deps
run: |
pip install -U pip setuptools wheel
sudo npm install -g jslint
sudo npm install -g prettier
pip install -U -r requirements-test.txt
pip install -U -e .
pip install ${{ matrix.django-version }}
Expand Down
49 changes: 0 additions & 49 deletions .jslintrc

This file was deleted.

28 changes: 17 additions & 11 deletions django_x509/static/django-x509/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
.field-private_key p,
.field-private_key div.readonly,
.field-private_key .vLargeTextField,
pre.x509{
font-family: monospace;
white-space: pre;
pre.x509 {
font-family: monospace;
white-space: pre;
}
.field-certificate .vLargeTextField,
.field-private_key .vLargeTextField{
height: 350px;
.field-private_key .vLargeTextField {
height: 350px;
}
.field-certificate p.help,
.field-private_key p.help{
font-family: inherit;
white-space: normal;
.field-private_key p.help {
font-family: inherit;
white-space: normal;
}
fieldset.x509-custom {
margin-top: 0;
}
fieldset.x509-custom .form-row {
padding: 0;
}
fieldset.x509-custom pre {
margin-top: 0;
}
fieldset.x509-custom { margin-top: 0 }
fieldset.x509-custom .form-row{ padding: 0 }
fieldset.x509-custom pre{ margin-top: 0 }
30 changes: 15 additions & 15 deletions django_x509/static/django-x509/css/renew_confirmation.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
input[type="submit"] {
background: #ba2121;
border-radius: 4px;
padding: 10px 15px;
color: #fff;
background: #ba2121;
border-radius: 4px;
padding: 10px 15px;
color: #fff;
}
a.cancel-link {
display: inline-block;
vertical-align: middle;
height: 15px;
line-height: 15px;
background: #ddd;
border-radius: 4px;
padding: 10px 15px;
color: #333;
margin: 0 0 0 10px;
display: inline-block;
vertical-align: middle;
height: 15px;
line-height: 15px;
background: #ddd;
border-radius: 4px;
padding: 10px 15px;
color: #333;
margin: 0 0 0 10px;
}
a.cancel-link:hover {
background-color: #ddd;
background-color: #ddd;
}
input[type="submit"]:hover {
background-color: #ba2121;
background-color: #ba2121;
}
102 changes: 55 additions & 47 deletions django_x509/static/django-x509/js/x509-admin.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,60 @@
django.jQuery(function ($) {
'use strict';
// select private_key/certificate field text on click
$('.field-certificate, .field-private_key').find(".readonly").on('click', function () {
var range, selection;
if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
} else if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(this);
range.select();
}
"use strict";
// select private_key/certificate field text on click
$(".field-certificate, .field-private_key")
.find(".readonly")
.on("click", function () {
var range, selection;
if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
} else if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(this);
range.select();
}
});
var changePopupPage = new RegExp(/\d\/change\/\?/);
var url = window.location.href;
var operationType = $('.field-operation_type select');
// enable switcher only in add forms
if (!operationType.length || $('form .deletelink-box').length > 0 || changePopupPage.test(url)) {
$('.field-operation_type').hide();
return;
var changePopupPage = new RegExp(/\d\/change\/\?/);
var url = window.location.href;
var operationType = $(".field-operation_type select");
// enable switcher only in add forms
if (
!operationType.length ||
$("form .deletelink-box").length > 0 ||
changePopupPage.test(url)
) {
$(".field-operation_type").hide();
return;
}
// function for operation_type switcher
var showFields = function () {
// define fields for each operation
var importFields = $(
".form-row:not(.field-certificate, .field-operation_type, " +
".field-private_key, .field-name, .field-ca, .field-passphrase)",
),
newFields = $(".form-row:not(.field-certificate, .field-private_key)"),
defaultFields = $(".form-row:not(.field-operation_type)"),
allFields = $(".form-row"),
value = operationType.val();
if (value === "-") {
allFields.show();
defaultFields.hide();
}
// function for operation_type switcher
var showFields = function () {
// define fields for each operation
var importFields = $('.form-row:not(.field-certificate, .field-operation_type, ' +
'.field-private_key, .field-name, .field-ca, .field-passphrase)'),
newFields = $('.form-row:not(.field-certificate, .field-private_key)'),
defaultFields = $('.form-row:not(.field-operation_type)'),
allFields = $('.form-row'),
value = operationType.val();
if (value === '-') {
allFields.show();
defaultFields.hide();
}
if (value === 'new') {
allFields.hide();
newFields.show();
}
if (value === 'import') {
allFields.show();
importFields.hide();
}
};
if (value === "new") {
allFields.hide();
newFields.show();
}
if (value === "import") {
allFields.show();
importFields.hide();
}
};
showFields();
operationType.on("change", function (e) {
showFields();
operationType.on('change', function (e) {
showFields();
});
});
});
6 changes: 3 additions & 3 deletions run-qa-checks
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

set -e

jslint django_x509/static/django-x509/js/*.js

openwisp-qa-check --migrations-to-ignore 4 \
--migration-path ./django_x509/migrations/ \
--migration-module django_x509
--migration-module django_x509 \
--csslinter \
--jslinter

echo ''
echo 'Running checks for SAMPLE_APP'
Expand Down