Commit b2bcf6b2 by Kyle Fiedler

Fixed change language and location bugs

parent ce6b8419
<%inherit file="main.html" /> <%inherit file="main.html" />
<script> <script>
var loc=true; // Activate on clicks? Not if already clicked. var loc=true; // Activate on clicks? Not if already clicked.
var lang=true; var lang=true;
$(function() { $(function() {
$("#change_location").click(function() { $("#change_location").click(function() {
log_event("profile", {"type":"location_show", "old":$("#location_sub").text()}); log_event("profile", {"type":"location_show", "old":$("#location_sub").text()});
if(loc) { if(loc) {
$("#description").html('<div style="color:#FF0000">'+ $("#description").html('<div>'+
"Preferred format is city, state, country (so for us, "+ "Preferred format is city, state, country (so for us, "+
"&quot;Cambridge, Massachusetts, USA&quot;), but give "+ "&quot;Cambridge, Massachusetts, USA&quot;), but give "+
"as much or as little detail as you want. </div>"); "as much or as little detail as you want. </div>");
loc=false; loc=false;
$("#location_sub").html('<input id="id_loc_text" type="text" name="loc_text" />'+
'<input type="button" id="change_loc_button" value="Change" />'); $("#location_sub").html('<input id="id_loc_text" type="text" name="loc_text" />'+
$("#change_loc_button").click(function() { '<input type="button" id="change_loc_button" value="Change" />');
postJSON('/change_setting', {'location':$("#id_loc_text").attr("value")}, function(json) { $("#change_loc_button").click(function() {
$("#location_sub").text(json.location); postJSON('/change_setting', {'location':$("#id_loc_text").attr("value")}, function(json) {
loc=true; $("#location_sub").text(json.location);
$("#description").html(""); loc=true;
log_event("profile", {"type":"location_change", "new":json.location}); $("#description").html("");
}); log_event("profile", {"type":"location_change", "new":json.location});
}); });
} });
}); }
});
$("#change_language").click(function() {
log_event("profile", {"type":"language_show", "old":$("#language_sub").text()}); $("#change_language").click(function() {
log_event("profile", {"type":"language_show", "old":$("#language_sub").text()});
if(lang) {
lang=false; if(lang) {
$("#language_sub").html('<input id="id_lang_text" type="text" name="lang_text" />'+ lang=false;
'<input type="button" id="change_lang_button" value="Change" />'); $("#language_sub").html('<input id="id_lang_text" type="text" name="lang_text" />'+
$("#change_lang_button").click(function() { '<input type="button" id="change_lang_button" value="Change" />');
postJSON('/change_setting', {'language':$("#id_lang_text").attr("value")}, function(json) { $("#change_lang_button").click(function() {
$("#language_sub").text(json.language); postJSON('/change_setting', {'language':$("#id_lang_text").attr("value")}, function(json) {
lang=true; $("#language_sub").text(json.language);
$("#description").html(""); lang=true;
log_event("profile", {"type":"language_change", "new":json.language}); $("#description").html("");
}); log_event("profile", {"type":"language_change", "new":json.language});
}); });
} });
}); }
});
$('#change_password').click(function(){
$('.modal').trigger('click'); $('#change_password').click(function(){
log_event("profile", {"type":"password_show"}); $('.modal').trigger('click');
}); log_event("profile", {"type":"password_show"});
});
$('#pwd_reset_button').click(function() { $('#pwd_reset_button').click(function() {
$.post('/password_reset/',{ "csrfmiddlewaretoken" : "${ csrf }", $.post('/password_reset/',{ "csrfmiddlewaretoken" : "${ csrf }",
...@@ -72,8 +73,12 @@ $(function() { ...@@ -72,8 +73,12 @@ $(function() {
<ul> <ul>
<li>Forum name: ${username}</li> <li>Forum name: ${username}</li>
<li>E-mail: ${email}</li> <li>E-mail: ${email}</li>
<li><a href="" id="change_location">Location: ${location}</a></li> <li>
<li><a href="" id="change_language">Language: ${language}</a></li> Location: <div id="location_sub">${location}</div><div id="description"></div> <a href="#" id="change_location">Change</a>
</li>
<li>
Language: <div id="language_sub">${language}</div> <a href="#" id="change_language">Change</a>
</li>
</ul> </ul>
<!-- <div><a class="modal" href="#change_password_pop">Reset password</a></div> --> <!-- <div><a class="modal" href="#change_password_pop">Reset password</a></div> -->
......
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