Don't show the loading spinner if Javascript is disabled.

master
Pacman Ghost 2 years ago
parent b285a044ab
commit 330d05e47d
  1. 2
      vasl_templates/webapp/static/help/index.html
  2. 8
      vasl_templates/webapp/static/help/main.js
  3. 8
      vasl_templates/webapp/static/main.js
  4. 2
      vasl_templates/webapp/templates/index.html
  5. 6
      vasl_templates/webapp/tests/test_turn_track.py
  6. 5
      vasl_templates/webapp/tests/utils.py

@ -15,7 +15,7 @@
<div style="margin:1em;"> Javascript is disabled. Please enable it, then reload this page. </div>
</noscript>
<img id="loader" src='images/loader.gif' style="position:fixed;top:50%;left:50%;margin-top:-16px;margin-left:-16px;">
<img id="loader" src='images/loader.gif' style="display:none;position:fixed;top:50%;left:50%;margin-top:-16px;margin-left:-16px;">
<!-- ----------------------------------------------------------------- -->

@ -3,6 +3,9 @@
$(document).ready( function() {
// initialize
$( "#loader" ).fadeIn( 250, function() {
// set the application name
var $caption = $( "#app-name" ) ;
var version = getUrlParam( "version" ) ;
@ -71,7 +74,10 @@ $(document).ready( function() {
var anchor = window.location.hash.substring( 1 ) ;
if ( anchor )
$( "a[name='" + anchor + "']" )[0].scrollIntoView() ;
} ) ;
} ) ; // nb: this closes the fadeIn() callback
} ) ; // nb: this closes the $(document).ready() handler
// --------------------------------------------------------------------

@ -40,6 +40,9 @@ EDIT_TEMPLATE_HINT = "Edit the template" ;
$(document).ready( function () {
// initialize
$( "#loader" ).fadeIn( 250, function() {
// initialize the PyQt web channel
if ( getUrlParam( "pyqt" ) ) {
$.getScript( "qrc:///qtwebchannel/qwebchannel.js", function() {
@ -543,7 +546,10 @@ $(document).ready( function () {
// flag that we've finished initialization
update_page_load_status( "main" ) ;
} ) ;
} ) ; // nb: this closes the fadeIn() callback
} ) ; // nb: this closes the $(document).ready() handler
function init_player_droplists()
{

@ -56,7 +56,7 @@
<div style="margin:1em;"> Javascript is disabled. Please enable it, then reload this page. </div>
</noscript>
<img id="loader" src="{{url_for('static',filename='images/loader.gif')}}" style="position:fixed;top:50%;left:50%;margin-top:-16px;margin-left:-16px;z-index:999;">
<img id="loader" src="{{url_for('static',filename='images/loader.gif')}}" style="display:none;position:fixed;top:50%;left:50%;margin-top:-16px;margin-left:-16px;z-index:999;">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

@ -7,7 +7,7 @@ from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from vasl_templates.webapp.tests.utils import \
init_webapp, get_turn_track_nturns, set_turn_track_nturns, select_droplist_val, get_droplist_vals, \
init_webapp, refresh_webapp, get_turn_track_nturns, set_turn_track_nturns, select_droplist_val, get_droplist_vals, \
SwitchFrame, unload_table, wait_for, wait_for_elem, wait_for_clipboard, find_child
from vasl_templates.webapp.tests.test_scenario_persistence import load_scenario, save_scenario
@ -229,7 +229,7 @@ def test_turn_track_persistence( webapp, webdriver ):
assert _generate_turn_track_snippet( None ) == expected
# reset the scenario
webdriver.refresh()
refresh_webapp()
assert not find_child( "button.generate[data-id='turn_track']" ).is_displayed()
# load the scenario and generate the snippet
@ -276,7 +276,7 @@ def test_turn_track_droplist( webapp, webdriver ):
# save and reload the scenario
find_child( ".ui-dialog.turn-track" ).send_keys( Keys.ESCAPE )
saved_scenario = save_scenario()
webdriver.refresh()
refresh_webapp()
load_scenario( saved_scenario )
assert _unload_turn_track_droplist() == expected

@ -72,7 +72,10 @@ def init_webapp( webapp, webdriver, **options ):
# reset the user settings
webdriver.delete_all_cookies()
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def refresh_webapp():
"""Refresh the webapp."""
_webdriver.refresh()
_wait_for_webapp()
def _wait_for_webapp():
"""Wait for the webapp to finish initialization."""

Loading…
Cancel
Save