diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1398c18..c323495 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.jslintrc b/.jslintrc deleted file mode 100644 index 9bb31b4..0000000 --- a/.jslintrc +++ /dev/null @@ -1,49 +0,0 @@ -{ - "predef": [ - "document", - "navigator", - "console", - "alert", - "django", - "window" - ], - - "adsafe": false, - "safe": false, - - "bitwise": false, - "cap": false, - "confusion": true, - "continue": true, - "css": true, - "debug": false, - "eqeq": false, - "es5": true, - "evil": false, - "forin": false, - "fragment": true, - "newcap": false, - "nomen": false, - "on": false, - "plusplus": false, - "regexp": true, - "sloppy": false, - "sub": false, - "undef": false, - "unparam": true, - "vars": true, - "white": false, - "validthis": true, - "strict_mode":true, - - "browser": false, - "devel": false, - "node": false, - "rhino": false, - "widget": false, - "windows": false, - "indent": 4, - "maxerr": 50, - "maxlen": 120, - "passfail": false -} diff --git a/django_x509/static/django-x509/css/admin.css b/django_x509/static/django-x509/css/admin.css index c679d95..864544b 100644 --- a/django_x509/static/django-x509/css/admin.css +++ b/django_x509/static/django-x509/css/admin.css @@ -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 } diff --git a/django_x509/static/django-x509/css/renew_confirmation.css b/django_x509/static/django-x509/css/renew_confirmation.css index 1654607..adcbf18 100644 --- a/django_x509/static/django-x509/css/renew_confirmation.css +++ b/django_x509/static/django-x509/css/renew_confirmation.css @@ -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; } diff --git a/django_x509/static/django-x509/js/x509-admin.js b/django_x509/static/django-x509/js/x509-admin.js index a9684c9..738a1ea 100644 --- a/django_x509/static/django-x509/js/x509-admin.js +++ b/django_x509/static/django-x509/js/x509-admin.js @@ -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(); - }); + }); }); diff --git a/run-qa-checks b/run-qa-checks index 63d6da8..2bd1f17 100755 --- a/run-qa-checks +++ b/run-qa-checks @@ -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'