diff --git a/plugins/unl_theme/scripts/JS/enhanceProfileForm.php b/plugins/unl_theme/scripts/JS/enhanceProfileForm.php index 9597b4511fc92d72f1d3fa109ffa48ed36fdd36f..0da3d639f11c08098e27dcf058505026e858ae4e 100644 --- a/plugins/unl_theme/scripts/JS/enhanceProfileForm.php +++ b/plugins/unl_theme/scripts/JS/enhanceProfileForm.php @@ -55,8 +55,7 @@ var to_parent = $("input[name=form_data_profile_attended_to]").parent(); $("input[name=form_data_profile_attended_to]").remove(); - $("input[name=form_data_profile_city]").parent().find("label").html('Your map location <span class="helper">Please enter the location you want to use for yourself on the map.</span>'); - + /********** Set up various year inputs */ var x = 1900, html = '<option value="">--</option>'; @@ -414,12 +413,27 @@ } $('form select[name=form_data_profile_role] option[value='+unlrole+']').attr('selected','selected'); - /********* DOB Label */ - $("label[for='form_data_profile_dob_month']").html('Birthday'); + /********* Hide and Change Labels */ + $("label[for='form_data_profile_city']").html('Your Map Location <span class="helper">Please enter the location you want to use for yourself on the map.</span>'); + $("label[for='form_data_profile_state']").remove(); + $("label[for='form_data_profile_country']").remove(); + + $("label[for='form_data_profile_homecity']").html('Hometown'); + $("label[for='form_data_profile_homestate']").remove(); + $("label[for='form_data_profile_homecountry']").remove(); + + $("label[for='form_data_profile_dob_month']").html('Birthday <span class="helper">Will only be visible to your friends.</span>'); $("label[for='form_data_profile_dob_day']").remove(); $("label[for='form_data_profile_dob_year']").remove(); - //Move Day to before year - $("input[name=form_data_profile_dob_day]").insertBefore($("select[name=form_data_profile_dob_year]")); + + /********* Move Fields Around */ + $("select[name='form_data_profile_state']").insertAfter($("input[name='form_data_profile_city']")); + $("select[name='form_data_profile_country']").insertAfter($("select[name='form_data_profile_state']")); + + $("select[name='form_data_profile_homestate']").insertAfter($("input[name='form_data_profile_homecity']")); + $("select[name='form_data_profile_homecountry']").insertAfter($("select[name='form_data_profile_homestate']")); + + $("input[name='form_data_profile_dob_day']").insertBefore($("select[name='form_data_profile_dob_year']")); //need to remove li left behind /********* DOB Month */ var dob_month = $("input[name=form_data_profile_dob_month]").val(); @@ -428,37 +442,44 @@ for (var i = 0, l = months.length; i < l; i++) { monthsHTML+= '<option value="' + months[i] + '">' + months[i] + '</option>'; } - $('form input[name=form_data_profile_dob_month]').replaceWith('<select name="form_data_profile_dob_month" class="input-pulldown">'+monthsHTML+'</select>'); - $("select[name=form_data_profile_dob_month] option[value=" + dob_month + "]").attr("selected","selected"); + $("form input[name='form_data_profile_dob_month']").replaceWith('<select name="form_data_profile_dob_month" class="input-pulldown">'+monthsHTML+'</select>'); + $("select[name='form_data_profile_dob_month'] option[value=" + dob_month + "]").attr("selected","selected"); /********* DOB Day */ - var dob_day = $("input[name=form_data_profile_dob_day]").val(); + var dob_day = $("input[name='form_data_profile_dob_day']").val(); var daysHTML = '<option value="">--</option>'; for (var i = 1, l = 32; i < l; i++) { daysHTML+= '<option value="' + i + '">' + i + '</option>'; } - $('form input[name=form_data_profile_dob_day]').replaceWith('<select name="form_data_profile_dob_day" class="input-pulldown">'+daysHTML+'</select>'); - $("select[name=form_data_profile_dob_day] option[value=" + dob_day + "]").attr("selected","selected"); + $("form input[name='form_data_profile_dob_day']").replaceWith('<select name="form_data_profile_dob_day" class="input-pulldown">'+daysHTML+'</select>'); + $("select[name='form_data_profile_dob_day'] option[value=" + dob_day + "]").attr("selected","selected"); /********* Alumni Checkbox */ - var alumniOptIn = $("input[name=form_data_info_alumni_opt_in]").val(); - $("input[name=form_data_info_alumni_opt_in]").replaceWith('<input type="checkbox" name="form_data_info_alumni_opt_in" value="yes" />'); + var alumniOptIn = $("input[name='form_data_info_alumni_opt_in']").val(); + $("input[name='form_data_info_alumni_opt_in']").replaceWith('<input type="checkbox" name="form_data_info_alumni_opt_in" value="yes" />'); if (alumniOptIn == "yes"){ - $("input[name=form_data_info_alumni_opt_in]").attr("checked","checked"); + $("input[name='form_data_info_alumni_opt_in']").attr("checked","checked"); } - $("input[name=form_data_info_alumni_opt_in]").parent().parent().children("label").css("width","350px"); + $("input[name='form_data_info_alumni_opt_in']").parent().parent().children("label").css("width","350px"); function alumniCheckbox () { - if ($("select[name=form_data_profile_role]").val() == "Alumnus") { - $("input[name=form_data_info_alumni_opt_in]").parent().show(); + if ($("select[name='form_data_profile_role']").val() == "Alumnus") { + $("input[name='form_data_info_alumni_opt_in']").parent().show(); } else { - $("input[name=form_data_info_alumni_opt_in]").parent().hide(); + $("input[name='form_data_info_alumni_opt_in']").parent().hide(); } }; alumniCheckbox(); - $("select[name=form_data_profile_role]").change(alumniCheckbox); + $("select[name='form_data_profile_role']").change(alumniCheckbox); - //$("body.fixed #maincontent textarea[name=form_data_profile_unl_impact]").parent().css({clear:"both",display:"block","margin-left":"150px"}).siblings("label").css("width","330px"); + /********* Cleanup */ + //Clear out all the empty li's we've built up + $("#profileEditor li").each(function(){ + if($.trim($(this).text()) == "") { + $(this).remove(); + } + }); + $("p.form-field-access").remove(); /********** Display Form */ $("#formloading").remove(); diff --git a/plugins/unl_theme/views/default/page_elements/header.php b/plugins/unl_theme/views/default/page_elements/header.php index aff1f6444eae3fd45b77996a1df0f3321750848c..00bcb82eb5bff9a4bd90d60a5126b5268172e815 100644 --- a/plugins/unl_theme/views/default/page_elements/header.php +++ b/plugins/unl_theme/views/default/page_elements/header.php @@ -76,8 +76,11 @@ if (preg_match('/friend/', $vars['title'])) { // if on a friends page, interst l text-transform: capitalize; } + input[name=form_data_profile_city], select[name=form_data_profile_state], select[name=form_data_profile_country], + input[name=form_data_profile_homecity], select[name=form_data_profile_homestate], select[name=form_data_profile_homecountry], select[name=form_data_profile_dob_month], select[name=form_data_profile_dob_day], select[name=form_data_profile_dob_year] { width: auto !important; + margin-right: 4px; } </style>