https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41452

--- Comment #1 from Saiful Amin <[email protected]> ---
Created attachment 194395
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194395&action=edit
Bug 41452 - Add optional "Beautify" formatting for CodeMirror SQL / JS / CSS
editors

Adds "Beautify" button in CodeMirror editors for SQL, JavaScript, and CSS code.

Latest minified versions of these two libraries are manually vendored in
koha-tmpl/intranet-tmpl/lib/:
- sql-formatter (https://github.com/sql-formatter-org/sql-formatter)
- js-beautify (https://github.com/beautify-web/js-beautify)

Test plan:
1. Apply the patch

2. Restart services and flush memcached
    In ktd: 'restart_all' and 'flush_memcached'

3. Test SQL formatting:
    - Go to Reports > Create from SQL
    - Copy any report from
https://wiki.koha-community.org/wiki/SQL_Reports_Library
    - Paste it in the editor
    - Click the "Beautify" button
    - Verify that the SQL code is formatted

4. Test JavaScript formatting:
    - Go to Administration > System preferences > search for "userjs"
    - Click on Edit on any preference, e.g. OPACUserJS or IntranetUserJS
    - Paste any JavaScript code in the editor, e.g.:
        `function test() { console.log("Hello"); }`
        Or copy any code from
https://wiki.koha-community.org/wiki/JQuery_Library
    - Click the "Beautify" button
    - Verify that the JavaScript code is formatted

5. Test CSS formatting:
    - Go to Administration > System preferences > search for "usercss"
    - Click on Edit on any preference, e.g. OPACUserCSS or IntranetUserCSS
    - Paste any CSS code in the editor, e.g.:
        `body { font-size: 12px; color: #333; }`
    - Click the "Beautify" button
    - Verify that the CSS code is formatted

6. Sign off

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to