Bugzilla – Attachment 94413 Details for
Bug 20930
Validate and cache parsed YAML/JSON type system preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20930: Make line and column number alert translatable
Bug-20930-Make-line-and-column-number-alert-transl.patch (text/plain), 2.64 KB, created by
Lari Taskula
on 2019-10-18 14:42:06 UTC
(
hide
)
Description:
Bug 20930: Make line and column number alert translatable
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2019-10-18 14:42:06 UTC
Size:
2.64 KB
patch
obsolete
>From a82776a6afc7676cdf8a5f7461ffe3ef22807bf5 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 18 Oct 2019 14:39:36 +0000 >Subject: [PATCH] Bug 20930: Make line and column number alert translatable > >To test: >1. Apply patch >2. Store invalid YAML syntax into OpacHiddenItems preference >3. Observe error >4. You should also see line and column number of where the error occured >--- > .../intranet-tmpl/prog/en/modules/admin/preferences.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 7 ++++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 920f59f77e..75fa80f42e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -213,6 +213,7 @@ > var MSG_UPD_LOC_FORMAT_WARN = _("The following values are not formatted correctly:"); > var MSG_INVALID = _( "Error: presence of invalid data prevents saving. Please make the corrections and try again." ); > var MSG_INVALID_SYNTAX = _( "Error: Preference '%s' has invalid syntax" ); >+ var MSG_INVALID_SYNTAX_LOCATION = _( "Problem found at line %s, column %s." ); > </script> > [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] > [% Asset.js("js/ajax.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index 43ee090c34..f1fd280089 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -56,9 +56,10 @@ KOHA.Preferences = { > if (modified_pref in form.sysprefs) { > if (form.sysprefs[modified_pref].error === 'Koha::Exceptions::Config::InvalidSyntax') { > msg += "<strong>"+ MSG_INVALID_SYNTAX.format(modified_pref) + "</strong>\n"; >- var error_message = form.sysprefs[modified_pref].message; >- error_message = error_message.replace(/\s+at .* line \d+\.\s+$/, ''); >- msg += error_message; >+ var location = form.sysprefs[modified_pref].message.match(/line (\d+), column (\d+)/); >+ if (typeof location !== 'undefined' && Array.isArray(location) && location.length===3) { >+ msg += "<strong>"+ MSG_INVALID_SYNTAX_LOCATION.format(location[1], location[2]) + "</strong>\n"; >+ } > } else { > msg += "<strong>"+ form.type + "</strong>\n"; > } >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20930
:
76382
|
76383
|
76384
|
91861
|
91862
|
91863
|
94412
|
94413
|
96108
|
96109
|
96110
|
96111
|
96112
|
96817
|
96818
|
96819
|
96820
|
96821