]> git.koha-community.org Git - koha.git/commit
Bug 24193: Add CodeMirror linting of JavaScript, CSS, HTML, and YAML
authorOwen Leonard <oleonard@myacpl.org>
Mon, 9 Dec 2019 18:17:34 +0000 (18:17 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 2 Mar 2020 10:44:14 +0000 (10:44 +0000)
commit08900d5653ee0a63ae4867d1a7c7337dac7529d3
treeff094d9bb4a0e537c5c5fa26b2432261993241be
parent0c6500f46776ee0682cc43d3ae3813e5e781cef9
Bug 24193: Add CodeMirror linting of JavaScript, CSS, HTML, and YAML
system preferences

This patch adds CodeMirror plugins for linting JS, CSS, HTML, and YAML.
When invalid data is entered in a linted CodeMirror editor an icon is
displayed in the editor's "gutter." Hovering over the icon displays the
error message.

This patch renames the minified CodeMirror JS file to match convention
but the version is unchanged.

To test, apply the patch and go to Administration -> System preferences.

Test preferences of each type and confirm that each type of CodeMirror
editor shows an error indicator if you entry invalid data. Valid data
should trigger no error indicator.

 - HTML: e.g.  OpacMainUserBlock,  opacheader. Enter invalid HTML, for
   example "<h1>Hello <h2>World</h2>."
   Example valid HTML: "<h1>Hello world</h1>"
 - JavaScript: e.g. OpacUserJS, IntranetUserJS. Example bad JS,
   "alert("Success!');"
   Example valid JS: "alert("Success!");"
 - CSS: e.g.  IntranetUserCSS, SCOUserCSS. Example bad CSS,
   "p { color blue }"
   Example valid CSS, "p { color: blue; }"
 - YAML: e.g. OpacHiddenItems. Example bad YAML:
   "one: two, three: four"
   Example valid YAML:
   "one: two
    three: four"

Also test that other CodeMirror instances still work correctly without
linting: The advanced MARC editor, SQL reports editing.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
27 files changed:
koha-tmpl/intranet-tmpl/lib/codemirror/codemirror-compressed.js [deleted file]
koha-tmpl/intranet-tmpl/lib/codemirror/codemirror.min.css [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/codemirror.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/css-lint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/css-lint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/html-lint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/html-lint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/javascript-lint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/javascript-lint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/lint.css [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/lint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/lint.min.css [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/lint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/yaml-lint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/codemirror/yaml-lint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/csslint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/csslint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/htmlhint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/js-yaml.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/js-yaml.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/jshint.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/lib/linters/jshint.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/editor.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js