Skip to content
Snippets Groups Projects
Commit 3445a07e authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

line up the location fields in a row on the edit profile form

parent 2d72b8d5
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment