From 345f02bf1032b177b50446ab7b1dbc2434d0cc37 Mon Sep 17 00:00:00 2001 From: Matthew Juhl <mjuhl24@gmail.com> Date: Tue, 1 Sep 2009 20:24:56 +0000 Subject: [PATCH] Profile view cleaned up. --- .../views/default/profile/userdetails.php | 4 +- unl_theme/scripts/social.js | 108 +++++++++++++++--- .../views/default/page_elements/header.php | 4 +- 3 files changed, 99 insertions(+), 17 deletions(-) diff --git a/flexprofile_mj/views/default/profile/userdetails.php b/flexprofile_mj/views/default/profile/userdetails.php index e802191e..f840b848 100755 --- a/flexprofile_mj/views/default/profile/userdetails.php +++ b/flexprofile_mj/views/default/profile/userdetails.php @@ -72,7 +72,7 @@ echo "<div id=\"profile_info\">"; //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - $body .= "<p class=\"{$even_odd}\"><b>"; + $body .= "<p id=\"profile_data_" . $item->title . "\" class=\"{$even_odd}\"><b>"; $body .= $item->title.':</b> '; $body .= $item->value; @@ -129,7 +129,7 @@ END; //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - $body .= "<p class=\"{$even_odd}\"><b>"; + $body .= "<p id=\"profile_data_" . str_replace(" ", "_", $item->title) . "\" class=\"{$even_odd}\"><b>"; $body .= $item->title.':</b> '; $body .= $item->value; diff --git a/unl_theme/scripts/social.js b/unl_theme/scripts/social.js index 4e584e81..04eaa536 100644 --- a/unl_theme/scripts/social.js +++ b/unl_theme/scripts/social.js @@ -1,15 +1,97 @@ WDN.jQuery(document).ready(function() { - //handle the search form label - WDN.jQuery('form#searchform label').css({display: "block"}); - WDN.jQuery('form#searchform input#search_input').focus(function(){ - WDN.jQuery(this).siblings("label").hide(); + +}); + +(function($) { + $(document).ready(function(){ + //handle the search form label + $('form#searchform label').css({display: "block"}); + $('form#searchform input#search_input').focus(function(){ + $(this).siblings("label").hide(); + }); + $('form#searchform input#search_input').blur(function(){ + if ($('form#searchform input#search_input').val() == "") { + $(this).siblings("label").show(); + }; + }); + //end handling of the search form label + //Add CSS to forms + WDN.jQuery('#maincontent div.formCool form').addClass("cool"); + $("#profile_data_Hometown_City a,p.odd a[href*=profile_city]").css("text-transform","capitalize"); + + if ($("#profile_info").length > 0) { + // fix the profile display + // fix the current/map location display + var city = $("#profile_data_City a").html(), state, country; + + + + if (city){ + $("#profile_data_State b, #profile_data_Country b").remove(); + state = $("#profile_data_State").html(); + country = $("#profile_data_Country").html(); + $("#profile_data_City b").html("Location:"); + + if (state) { + + $("#profile_data_City").append(", " + state); + $("#profile_data_State").remove(); + } + + if (country) { + $("#profile_data_City").append(", " + country); + $("#profile_data_Country").remove(); + } + } + + //$("#profile_data_Explanation b").remove(); + // fix the hometown location display + var hcity = $("#profile_data_Hometown_City a").html(), hstate, hcountry; + if (hcity){ + $("#profile_data_Hometown_State b, #profile_data_Hometown_Country b").remove(); + $("#profile_data_Hometown_City b").html("Hometown:"); + hstate = $("#profile_data_Hometown_State").html(); + hcountry = $("#profile_data_Hometown_Country").html(); + + if (hstate) { + + $("#profile_data_Hometown_City").append(", " + hstate); + $("#profile_data_Hometown_State").remove(); + } + + if (hcountry) { + $("#profile_data_Hometown_City").append(", " + hcountry); + $("#profile_data_Hometown_Country").remove(); + } + } + // fix the years attended + if ($("#profile_data_To").length > 0) { + if ($("#profile_data_Years_Attended_UNL").length > 0) { + // we have to and from here + $("#profile_data_To b").remove(); + var to = $("#profile_data_To").html(); + $("#profile_data_Years_Attended_UNL").append(" to " + to); + $("#profile_data_To").remove(); + } else { + + $("#profile_data_To b").html("Year Attended UNL: "); + } + } + // fix birthday (set up to handle various cases, even though right now we require all fields) + if ($("#profile_data_Month").length > 0){ + $("#profile_data_Month b").html("Birthday:"); + $("#profile_data_Day b").remove(); + $("#profile_data_Day").append(", "); + $("#profile_data_Month").append($("#profile_data_Day").html()); + $("#profile_data_Day").remove(); + $("#profile_data_Year b").remove(); + $("#profile_data_Month").append($("#profile_data_Year").html()); + $("#profile_data_Year").remove(); + } else if ($("#profile_data_Year").length > 0) { + // just birth year should be displayed + $("#profile_data_Day").remove(); + $("#profile_data_Year b").html("Birthday"); + } + } }); - WDN.jQuery('form#searchform input#search_input').blur(function(){ - if (WDN.jQuery('form#searchform input#search_input').val() == "") { - WDN.jQuery(this).siblings("label").show(); - }; - }); - //end handling of the search form label - //Add CSS to forms - WDN.jQuery('#maincontent div.formCool form').addClass("cool"); -}); \ No newline at end of file +})(WDN.jQuery); diff --git a/unl_theme/views/default/page_elements/header.php b/unl_theme/views/default/page_elements/header.php index 9e6aba51..6c416b66 100644 --- a/unl_theme/views/default/page_elements/header.php +++ b/unl_theme/views/default/page_elements/header.php @@ -173,7 +173,7 @@ if ($vars['title'] == "Edit profile") { var selFrom = document.createElement("select"); selFrom.name = "form_data_profile_attended_from"; x = 1940; - html = "<option></option><option>Did Not Attend UNL</option>"; + html = '<option></option>'; while (x++ < curYear + 6) { html+= '<option'; if (x == from_year) { @@ -188,7 +188,7 @@ if ($vars['title'] == "Edit profile") { var selTo = document.createElement("select"); selTo.name = "form_data_profile_attended_to"; x = 1940; - html = "<option></option><option>Did Not Attend UNL</option>"; + html = '<option></option>'; while (x++ < curYear + 6) { html+= '<option'; if (x == to_year) { -- GitLab