Skip to content
Snippets Groups Projects
Commit 1b1d8273 authored by Matthew Juhl's avatar Matthew Juhl
Browse files

More profile editor awesomeness.

parent 2114e1c1
Branches
No related tags found
No related merge requests found
......@@ -71,7 +71,7 @@ if ($vars['title'] == "Edit profile") {
(function(){
// Edit Profile Stuff
function updateLL () {
var city = $("input[name=form_data_profile_city]").val(), state = $("input[name=form_data_profile_state]").val(), country = $("input[name=form_data_profile_country]").val();
var city = $("input[name=form_data_profile_city]").val(), state = $("select[name=form_data_profile_state]").val(), country = $("select[name=form_data_profile_country]").val();
$.get("<?php echo $vars['url']; ?>mod/unl_theme/scripts/latlon.php",{city:city,state:state,country:country},function(response){
try {
var data = eval(response);
......@@ -81,10 +81,21 @@ if ($vars['title'] == "Edit profile") {
});
};
function updateLLhome () {
var city = $("input[name=form_data_profile_homecity]").val(), state = $("select[name=form_data_profile_homestate]").val(), country = $("select[name=form_data_profile_homecountry]").val();
$.get("<?php echo $vars['url']; ?>mod/unl_theme/scripts/latlon.php",{city:city,state:state,country:country},function(response){
try {
var data = eval(response);
$("input[name=form_data_hometown_latitude]").val(data.latitude);
$("input[name=form_data_hometown_longitude]").val(data.longitude);
} catch (e) {}
});
};
$(document).ready(function(){
/* SET UP PROFILE EDIT FORM */
$("form.cool fieldset:first-child").css("margin-top","0");
$("p.form-description").remove();
// get the year and country values for later use
var dob_year = $("input[name=form_data_profile_dob_year]").val();
......@@ -131,8 +142,8 @@ if ($vars['title'] == "Edit profile") {
var to_parent = $("input[name=form_data_profile_attended_to]").parent();
$("input[name=form_data_profile_attended_to]").remove();
country_parent.parent().css("border-bottom","#CCC 1px dotted");
$("input[name=form_data_profile_city]").parent().parent().css("border-top","#CCC 1px dotted");
$("input[name=form_data_map_explanation]").parent().parent().css("border-bottom","#CCC 1px dotted");
$("input[name=form_data_profile_city]").parent().parent().prepend('<h6 style="width:150px;margin:0;text-align:right;"><strong>Your Map Location</strong></h6>');
/* set up various year inputs */
......@@ -454,10 +465,16 @@ if ($vars['title'] == "Edit profile") {
// don't display the latitude/longitude fields
$("input[name=form_data_latitude],input[name=form_data_longitude]").parent().parent().hide();
// update the lat/long automatically whenever current location is changed
$("input[name=form_data_profile_city],input[name=form_data_profile_state],input[name=form_data_profile_country]").change(function(){
$("input[name=form_data_profile_city],select[name=form_data_profile_state],select[name=form_data_profile_country]").change(function(){
updateLL();
});
$("input[name=form_data_hometown_latitude],input[name=form_data_hometown_longitude]").parent().parent().hide();
// update the lat/long automatically whenever current location is changed
$("input[name=form_data_profile_homecity],select[name=form_data_profile_homestate],select[name=form_data_profile_homecountry]").change(function(){
updateLLhome();
});
$("form.cool label").each(function(){
if (this.innerHTML.match(/day/i) || this.innerHTML.match(/year\s*$/i) ){
$(this).parent().remove();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment