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

Profile editor view fixes

parent 21f3e616
Branches
No related tags found
No related merge requests found
...@@ -26,10 +26,10 @@ if ($form) { ...@@ -26,10 +26,10 @@ if ($form) {
/* import forms css */ /* import forms css */
echo '<style type="text/css">@IMPORT url("/wdn/templates_3.0/css/content/forms.css");</style>'; echo '<style type="text/css">@IMPORT url("/wdn/templates_3.0/css/content/forms.css");</style>';
/* add 'cool' class to form */ /* 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">'; echo '<form action="'.$vars['url'].'action/flexprofile/edit" method="post" enctype="multipart/form-data" class="cool">';
/* add fieldset and legend */ /* 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: */ /* mjuhl: remove dynamic form by commenting out the following line: */
echo '<!--------start copying here------------>'; 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)); 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------------>'; ...@@ -46,7 +46,7 @@ echo '<!--------stop copying here------------>';
<input type="submit" value="<?php echo elgg_echo("save"); ?>" /> <input type="submit" value="<?php echo elgg_echo("save"); ?>" />
</p> </p>
</ol>
</form> </form>
<?php <?php
} else { } else {
... ...
......
...@@ -49,6 +49,24 @@ echo elgg_view('metatags',$vars); ...@@ -49,6 +49,24 @@ echo elgg_view('metatags',$vars);
<?php <?php
if ($vars['title'] == "Edit profile") { 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"> <script type="text/javascript">
(function(){ (function(){
// Edit Profile Stuff // Edit Profile Stuff
...@@ -64,12 +82,68 @@ if ($vars['title'] == "Edit profile") { ...@@ -64,12 +82,68 @@ if ($vars['title'] == "Edit profile") {
}; };
$(document).ready(function(){ $(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 // 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 // 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],input[name=form_data_profile_state],input[name=form_data_profile_country]").change(function(){
updateLL(); 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> </script>
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment