Improved how we show extra info in notification balloons.

master
Pacman Ghost 3 years ago
parent 411a06a0b6
commit 88acf031fc
  1. 15
      asl_rulebook2/webapp/static/MainApp.js
  2. 2
      asl_rulebook2/webapp/static/NavPane.js
  3. 9
      asl_rulebook2/webapp/static/utils.js

@ -78,7 +78,7 @@ gMainApp.component( "main-app", {
return getJSON( gGetAppConfigUrl ).then( (resp) => { //eslint-disable-line no-undef
gAppConfig = resp ;
} ).catch( (errorMsg) => {
this.showErrorMsg( "Couldn't get the app config.", errorMsg ) ;
showErrorMsg( "Couldn't get the app config.", errorMsg ) ;
} ) ;
},
@ -98,7 +98,7 @@ gMainApp.component( "main-app", {
} ) ;
}
} ).catch( (errorMsg) => {
this.showErrorMsg( "Couldn't get the content docs.", errorMsg ) ;
showErrorMsg( "Couldn't get the content docs.", errorMsg ) ;
} ) ;
},
@ -107,7 +107,7 @@ gMainApp.component( "main-app", {
return getJSON( gGetFootnotesUrl ).then( (resp) => { //eslint-disable-line no-undef
gFootnoteIndex = resp ;
} ).catch( (errorMsg) => {
this.showErrorMsg( "Couldn't get the footnote index.", errorMsg ) ;
showErrorMsg( "Couldn't get the footnote index.", errorMsg ) ;
} ) ;
},
@ -129,7 +129,7 @@ gMainApp.component( "main-app", {
} ) ;
}
} ).catch( (errorMsg) => {
this.showErrorMsg( "Couldn't get the ASOP.", errorMsg ) ;
showErrorMsg( "Couldn't get the ASOP.", errorMsg ) ;
} ) ;
},
@ -179,15 +179,10 @@ gMainApp.component( "main-app", {
} ) ;
} ) ;
} ).catch( (errorMsg) => {
this.showErrorMsg( "Couldn't get the startup messages.", errorMsg ) ;
showErrorMsg( "Couldn't get the startup messages.", errorMsg ) ;
} ) ;
},
showErrorMsg( msg, errorMsg ) {
// show an error notification balloon
showErrorMsg( msg + " <div class='pre'>" + errorMsg + "</div>" ) ;
},
onEscapePressed() {
// check if an image is currently zoomed
if ( $(".jquery-image-zoom").length > 0 ) {

@ -44,7 +44,7 @@ gMainApp.component( "nav-pane", {
this.ruleInfo = resp ;
}
} ).catch( (errorMsg) => {
showWarningMsg( "Couldn't get the Q+A for " + ruleid + ". <div class='pre'>" + errorMsg + "</div>" ) ;
showWarningMsg( "Couldn't get the Q+A for " + ruleid + ".", errorMsg ) ;
} ) ;
} ) ;

@ -93,11 +93,14 @@ export function getChapterResource( rtype, chapterId )
// --------------------------------------------------------------------
export function showInfoMsg( msg ) { showNotificationMsg( "notice", msg ) ; }
export function showWarningMsg( msg ) { showNotificationMsg( "warning", msg ) ; }
export function showErrorMsg( msg ) { showNotificationMsg( "error", msg ) ; }
export function showWarningMsg( msg, info ) { showNotificationMsg( "warning", msg, info ) ; }
export function showErrorMsg( msg, info ) { showNotificationMsg( "error", msg, info ) ; }
export function showNotificationMsg( msgType, msg )
export function showNotificationMsg( msgType, msg, info )
{
if ( info )
msg += " <div class='pre'>" + info + "</div>" ;
if ( gUrlParams.get( "store-msgs" ) ) {
// store the message for the test suite
$( "#_last-" + msgType + "-msg_" ).val( msg ) ;

Loading…
Cancel
Save