Commit 63147038 authored by Dave Lane's avatar Dave Lane

Attempt at fixing bug #11 - should remove the spurious resetting of a new...

Attempt at fixing bug #11 - should remove the spurious resetting of a new country to the previous country on edit profile, or a warning about an invalid missing country on registration
parent b9a6c280
......@@ -83,7 +83,7 @@ jQuery(document).ready(function() {
* Menu for an unauthenticated (anonymous) user
*/
function visitor_menu() {
text = '<div class="ore-menu-block ore-left"><p>If you don\'t yet have an account, we invite you to</p><p style="text-align: center;"> <span id="ore-register-button" class="button ore-button" data-toggle="modal" data-target="#ore-modal">Register</span></p></div><div class="ore-menu-block ore-right"><p>If you already have an account, please</p><p style="text-align: center;"><span id="ore-login-button" class="button ore-button" data-toggle="modal" data-target="#ore-modal">Log In</span></p></div>';
text = '<div class="ore-menu-block ore-left"><p>Don\'t have an account? We invite you to</p><p style="text-align: center;"> <span id="ore-register-button" class="button ore-button" data-toggle="modal" data-target="#ore-modal">Register</span></p></div><div class="ore-menu-block ore-right"><p>Already have an account? Please</p><p style="text-align: center;"><span id="ore-login-button" class="button ore-button" data-toggle="modal" data-target="#ore-modal">Log In</span></p></div>';
LOG('new text: '+text);
// enable menus
prepare_menu(text);
......@@ -626,7 +626,7 @@ function show_modal(id) {
set_country(form, 'default');
} else {
LOG('Setting to '+user.country);
set_country(form, user.country);
//set_country(form, user.country);
}
}
// enable validation
......@@ -730,7 +730,13 @@ function modal_events(action){
LOG('completed ajax call for', action);
// check if a new hash has been specified by the submit, and act on it!
//close_modal();
check_hash(window.location.hash);
new_hash = window.location.hash;
if (new_hash != current_hash) {
LOG("We've got a new hash "+new_hash+" replacing "+current_hash+"...");
//check_hash(new_hash);
} else {
LOG("We're already looking at this has: ", current_hash);
}
} else {
LOG('failed to complete ajax call for', action);
}
......@@ -829,6 +835,7 @@ function ajax_submit(action, special_data) {
} else {
LOG('this data has neither success nor failed');
}
//not_busy();
check_hash(window.location.hash);
if (data.hasOwnProperty('failed')) {
LOG('Showing errors!', data.failed.errors.ore_error);
......@@ -977,6 +984,10 @@ function reload(hash = null) {
function check_hash(hash) {
if (hash == "") return;
hash = hash.replace('#','');
if (hash == current_hash) {
LOG("We're already looking at this has: ", current_hash);
return;
}
//LOG('checking if ore_data is visible: ', ore_data);
if (hash != "") {
LOG('Hash found: ('+hash+')');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment