Tightened up formatting in notification messages.

master
Pacman Ghost 6 years ago
parent 633a07509e
commit 7150529ec0
  1. 14
      vasl_templates/webapp/static/generate.js
  2. 2
      vasl_templates/webapp/static/main.js
  3. 2
      vasl_templates/webapp/static/utils.js

@ -96,7 +96,7 @@ function generate_snippet( $btn )
if ( missing_params.length > 0 ) { if ( missing_params.length > 0 ) {
var buf = [ "Missing parameters:<ul>" ] ; var buf = [ "Missing parameters:<ul>" ] ;
for ( var i=0 ; i < missing_params.length ; ++i ) for ( var i=0 ; i < missing_params.length ; ++i )
buf.push( "<li>" + escapeHTML(missing_params[i]) ) ; buf.push( "<li> <span class='pre'>" + escapeHTML(missing_params[i]) + "</span>" ) ;
buf.push( "</ul>" ) ; buf.push( "</ul>" ) ;
showWarningMsg( buf.join("") ) ; showWarningMsg( buf.join("") ) ;
} }
@ -123,7 +123,7 @@ function generate_snippet( $btn )
else if ( template_id in gDefaultTemplates ) else if ( template_id in gDefaultTemplates )
templ = gDefaultTemplates[template_id] ; templ = gDefaultTemplates[template_id] ;
else { else {
showErrorMsg( "Unknown template: " + escapeHTML(template_id) ) ; showErrorMsg( "Unknown template: <span class='pre'>" + escapeHTML(template_id) + "</span>" ) ;
return ; return ;
} }
var func ; var func ;
@ -131,7 +131,7 @@ function generate_snippet( $btn )
func = jinja.compile( templ ).render ; func = jinja.compile( templ ).render ;
} }
catch( ex ) { catch( ex ) {
showErrorMsg( "Can't compile template:<pre>" + escapeHTML(ex) + "</pre>" ) ; showErrorMsg( "Can't compile template:<div class='pre'>" + escapeHTML(ex) + "</div>" ) ;
return ; return ;
} }
@ -147,14 +147,14 @@ function generate_snippet( $btn )
val = val.trim() ; val = val.trim() ;
} }
catch( ex ) { catch( ex ) {
showErrorMsg( "Can't process template <em>\"" + template_id + "\"</em>:<pre>" + escapeHTML(ex) + "</pre>" ) ; showErrorMsg( "Can't process template: <span class='pre'>" + template_id + "</span><div class='pre'>" + escapeHTML(ex) + "</div>" ) ;
return ; return ;
} }
try { try {
copyToClipboard( val ) ; copyToClipboard( val ) ;
} }
catch( ex ) { catch( ex ) {
showErrorMsg( "Can't copy to the clipboard:<pre>" + escapeHTML(ex) + "</pre>" ) ; showErrorMsg( "Can't copy to the clipboard:<div class'pre'>" + escapeHTML(ex) + "</div>" ) ;
return ; return ;
} }
showInfoMsg( "The HTML snippet has been copied to the clipboard." ) ; showInfoMsg( "The HTML snippet has been copied to the clipboard." ) ;
@ -207,7 +207,7 @@ function on_load_scenario_file_selected()
try { try {
data = JSON.parse( fileReader.result ) ; data = JSON.parse( fileReader.result ) ;
} catch( ex ) { } catch( ex ) {
showErrorMsg( "Can't load the scenario file:<div>" + escapeHTML(ex) + "</div>" ) ; showErrorMsg( "Can't load the scenario file:<div class='pre'>" + escapeHTML(ex) + "</div>" ) ;
return ; return ;
} }
do_load_scenario( data ) ; do_load_scenario( data ) ;
@ -250,7 +250,7 @@ function do_load_scenario( params )
var buf = [] ; var buf = [] ;
for ( key in params ) { for ( key in params ) {
if ( ! (key in params_loaded) ) if ( ! (key in params_loaded) )
buf.push( "<li>" + key + " = '" + escapeHTML(params[key]) + "'" ) ; buf.push( "<li> <span class='pre'>" + escapeHTML(key) + " = <span class='pre'>'" + escapeHTML(params[key]) + "</span>'" ) ;
} }
if ( buf.length > 0 ) if ( buf.length > 0 )
showWarningMsg( "Unknown keys in the scenario file:<ul>" + buf.join("") + "</ul>" ) ; showWarningMsg( "Unknown keys in the scenario file:<ul>" + buf.join("") + "</ul>" ) ;

@ -113,7 +113,7 @@ $(document).ready( function () {
$("select[name='PLAYER_2']").html( buf ) ; $("select[name='PLAYER_2']").html( buf ) ;
on_new_scenario( false ) ; on_new_scenario( false ) ;
} ).fail( function( xhr, status, errorMsg ) { } ).fail( function( xhr, status, errorMsg ) {
showErrorMsg( "Can't get the nationalities:<pre>" + escapeHTML(errorMsg) + "</pre>" ) ; showErrorMsg( "Can't get the nationalities:<div class='pre'>" + escapeHTML(errorMsg) + "</div>" ) ;
} ) ; } ) ;
// add handlers for player changes // add handlers for player changes

@ -23,7 +23,7 @@ function copyToClipboard( val )
console.log( "CLIPBOARD:", val ) ; console.log( "CLIPBOARD:", val ) ;
} }
catch( ex ) { catch( ex ) {
showErrorMsg( "Can't copy to the clipboard:<pre>" + escapeHTML(ex) + "</pre>" ) ; showErrorMsg( "Can't copy to the clipboard:<div class='pre'>" + escapeHTML(ex) + "</div>" ) ;
} }
finally { finally {
document.body.removeChild( textarea ) ; document.body.removeChild( textarea ) ;

Loading…
Cancel
Save