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

Profile editor view fixes

parent 21f3e616
No related branches found
No related tags found
No related merge requests found
......@@ -26,10 +26,10 @@ if ($form) {
/* import forms css */
echo '<style type="text/css">@IMPORT url("/wdn/templates_3.0/css/content/forms.css");</style>';
/* add 'cool' class to form */
echo '<div id="formloading"><img src="http://ucommjuhl.unl.edu/wdn/templates_3.0/css/header/images/colorbox/loading.gif" alt="Loading Form" /></div>';
echo '<form action="'.$vars['url'].'action/flexprofile/edit" method="post" enctype="multipart/form-data" class="cool">';
/* add fieldset and legend */
echo '<fieldset><legend>Edit Profile</legend>';
echo '<fieldset><legend>Edit Profile</legend><ol>';
/* mjuhl: remove dynamic form by commenting out the following line: */
echo '<!--------start copying here------------>';
echo elgg_view('form/forms/display_form_content',array('tab_data'=>$tab_data,'description'=>'','preview'=>0,'form'=>$form,'form_data_id'=>0));
......@@ -46,7 +46,7 @@ echo '<!--------stop copying here------------>';
<input type="submit" value="<?php echo elgg_echo("save"); ?>" />
</p>
</ol>
</form>
<?php
} else {
......
......@@ -49,6 +49,24 @@ echo elgg_view('metatags',$vars);
<?php
if ($vars['title'] == "Edit profile") {
?>
<style type="text/css">
#maincontent form.cool {
display: none;
}
#maincontent form.cool div.element {
margin: 0;
}
#maincontent form.cool label {
vertical-align: inherit !important;
}
#maincontent form.cool fieldset li {
padding-bottom: 15px;
}
</style>
<script type="text/javascript">
(function(){
// Edit Profile Stuff
......@@ -64,12 +82,68 @@ if ($vars['title'] == "Edit profile") {
};
$(document).ready(function(){
/* SET UP PROFILE EDIT FORM */
// get the dob_year for later use
var dob_year = $("input[name=form_data_profile_dob_year]").val();
// remove the text input. will be replacing with a selector
$("input[name=form_data_profile_dob_year]").remove();
// wrap the fields in <li>s
$("form.cool label").wrap("<li></li>");
$("form.cool label br").remove();
$("form.cool p.form-field-description").each(function(){
$(this).appendTo($(this).prev()).css({
marginLeft: "162px",
fontSize: "75%",
color: "#1091D1"
});
});
$("form.cool fieldset input, form.cool fieldset select").wrap('<div class="element"></div>');
$("form.cool label div").each(function(){
$(this).insertAfter($(this).parent());
});
var selYear = document.createElement("select");
selYear.name = "form_data_profile_dob_year";
var x = 1900, html = "";
while (x++ < (new Date()).getFullYear()) {
html+= '<option';
if (x == dob_year) {
html += ' selected="selected"'
}
html += '>' + x + '</option>';
}
selYear.innerHTML = html;
$("select[name=form_data_profile_dob_month]").parent().append(selYear);
$("select[name=form_data_profile_dob_day]").insertBefore($("select[name=form_data_profile_dob_year]"));
// don't display the latitude/longitude fields
$("input[name=form_data_latitude],input[name=form_data_longitude]").parent().hide();
$("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(){
updateLL();
});
$("form.cool label").each(function(){
if (this.innerHTML.match(/day/i) || this.innerHTML.match(/year\s*$/i) ){
$(this).parent().remove();
} else if (this.innerHTML.match(/month/i)) {
this.innerHTML = "Birthday";
}
});
$("#formloading").remove();
$("#maincontent form.cool").show();
});
})();
</script>
......
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