Skip to content

Commit

Permalink
Use short header on pages other than Public Portfolio
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Feb 21, 2014
1 parent a862a57 commit b808525
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 56 deletions.
2 changes: 1 addition & 1 deletion assets/css/screen.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions assets/js/cacap.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ window.wp = window.wp || {};
* Set up the sticky header.
*/
function init_stickyheader() {
if ( $( 'body' ).hasClass( 'short-header' ) ) {
return;
}

window_height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;

if ( window_height < $(document).height() - 200 ) {
Expand Down
6 changes: 6 additions & 0 deletions assets/sass/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ body.cacap, body.bp-user {
}
}

body.short-header {
#cacap-header {
height: 40px;
}
}

#cacap-header {
background: transparent url('../images/black_linen_v2.png');
padding: 0 10px 30px;
Expand Down
4 changes: 4 additions & 0 deletions includes/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ public function body_class( $classes ) {
$classes[] = 'cacap';
}

if ( cacap_is_commons_profile() ) {
$classes[] = 'short-header';
}

return $classes;
}

Expand Down
16 changes: 16 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,19 @@ function cacap_sanitize_content( $content ) {
'ul' => array(),
) );
}

function cacap_is_commons_profile() {
if ( bp_is_user() ) {
if ( ! empty( $_GET['commons-profile'] ) && 1 == $_GET['commons-profile'] ) {
return true;
}

if ( ! bp_is_profile_component() ) {
return true;
}
}

return false;

return bp_is_user() && ( empty( $_GET['commons-profile'] ) || 1 != $_GET['commons-profile'] || ! bp_is_profile_component()) ;
}
2 changes: 1 addition & 1 deletion templates/cacap/header-top.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
?>

<div class="cacap-row cacap-hero-row">
<div class="cacap-row cacap-hero-row<?php if ( cacap_is_commons_profile() ) : ?> stuck<?php endif ?>">
<div class="cacap-sticky-dummy">
<div class="cacap-hero">
<h1>
Expand Down
109 changes: 55 additions & 54 deletions templates/cacap/header.php
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
<?php bp_get_template_part( 'cacap/header-top' ) ?>

<div class="cacap-row">
<dl id="cacap-vitals">
<?php
buddypress()->social_media_profiles->setup_user_sm_fields();
<?php if ( ! cacap_is_commons_profile() ) : ?>
<div class="cacap-row">
<dl id="cacap-vitals">
<?php
buddypress()->social_media_profiles->setup_user_sm_fields();

$user_sm_fields = buddypress()->social_media_profiles->user_sm_fields;
$user_sm_fields_html = '';
$user_sm_fields = buddypress()->social_media_profiles->user_sm_fields;
$user_sm_fields_html = '';

foreach ( (array) $user_sm_fields as $field ) {
$user_sm_fields_html .= $field['html'];
}
?>
foreach ( (array) $user_sm_fields as $field ) {
$user_sm_fields_html .= $field['html'];
}
?>

<?php if ( $user_sm_fields_html ) : ?>
<dt class="cacap-vitals-contact">Follow me Online</dt>
<dd class="cacap-vitals-contact"><?php echo $user_sm_fields_html ?></dd>
<div clear="both"> </div>
<?php endif ?>
<?php if ( $user_sm_fields_html ) : ?>
<dt class="cacap-vitals-contact">Follow me Online</dt>
<dd class="cacap-vitals-contact"><?php echo $user_sm_fields_html ?></dd>
<div clear="both"> </div>
<?php endif ?>

<?php
$contact_info = array();
<?php
$contact_info = array();

if ( cacap_field_is_visible_for_user( 'Phone' ) ) {
$phone = xprofile_get_field_data( 'Phone', bp_displayed_user_id() );
if ( $phone ) {
$contact_info[] = $phone;
if ( cacap_field_is_visible_for_user( 'Phone' ) ) {
$phone = xprofile_get_field_data( 'Phone', bp_displayed_user_id() );
if ( $phone ) {
$contact_info[] = $phone;
}
}
}

if ( cacap_field_is_visible_for_user( 'Email Address' ) ) {
$email = xprofile_get_field_data( 'Email Address', bp_displayed_user_id() );
if ( $email ) {
$contact_info[] = $email;
if ( cacap_field_is_visible_for_user( 'Email Address' ) ) {
$email = xprofile_get_field_data( 'Email Address', bp_displayed_user_id() );
if ( $email ) {
$contact_info[] = $email;
}
}
}

$contact_info = implode( ' &middot; ', $contact_info );
?>
$contact_info = implode( ' &middot; ', $contact_info );
?>

<?php if ( $contact_info ) : ?>
<dt><?php _e( 'Contact', 'cacap' ) ?></dt>
<dd><?php echo $contact_info ?></dd>
<?php endif ?>

<?php if ( cacap_field_is_visible_for_user( 'Website' ) ) : ?>
<?php $website = xprofile_get_field_data( 'Website', bp_displayed_user_id() ) ?>
<?php if ( $website ) : ?>
<dt><?php _e( 'Website', 'cacap' ) ?></dt>
<dd><a href="<?php echo esc_url( $website ) ?>"><?php echo esc_html( $website ) ?></a></dd>
<?php if ( $contact_info ) : ?>
<dt><?php _e( 'Contact', 'cacap' ) ?></dt>
<dd><?php echo $contact_info ?></dd>
<?php endif ?>
<?php endif ?>

<?php if ( cacap_field_is_visible_for_user( 'Blog' ) ) : ?>
<?php $blog = xprofile_get_field_data( 'Blog', bp_displayed_user_id() ) ?>
<?php if ( $blog ) : ?>
<dt><?php _e( 'Blog', 'cacap' ) ?></dt>
<dd><a href="<?php echo esc_url( $blog ) ?>"><?php echo esc_html( $blog ) ?></a></dd>
<?php if ( cacap_field_is_visible_for_user( 'Website' ) ) : ?>
<?php $website = xprofile_get_field_data( 'Website', bp_displayed_user_id() ) ?>
<?php if ( $website ) : ?>
<dt><?php _e( 'Website', 'cacap' ) ?></dt>
<dd><a href="<?php echo esc_url( $website ) ?>"><?php echo esc_html( $website ) ?></a></dd>
<?php endif ?>
<?php endif ?>
<?php endif ?>

<?php if ( function_exists( 'cac_yourls_get_user_shorturl' ) ) : ?>
<?php $shorturl = cac_yourls_get_user_shorturl( bp_displayed_user_id() ) ?>
<?php if ( $shorturl ) : ?>
<dt><?php _e( 'Quick Link', 'cacap' ) ?></dt>
<dd><a href="http://cuny.is/<?php echo esc_attr( $shorturl ) ?>">http://cuny.is/<?php echo esc_html( $shorturl ) ?></a></dd>
<?php if ( cacap_field_is_visible_for_user( 'Blog' ) ) : ?>
<?php $blog = xprofile_get_field_data( 'Blog', bp_displayed_user_id() ) ?>
<?php if ( $blog ) : ?>
<dt><?php _e( 'Blog', 'cacap' ) ?></dt>
<dd><a href="<?php echo esc_url( $blog ) ?>"><?php echo esc_html( $blog ) ?></a></dd>
<?php endif ?>
<?php endif ?>
<?php endif ?>
</dl>
</div>

<?php if ( function_exists( 'cac_yourls_get_user_shorturl' ) ) : ?>
<?php $shorturl = cac_yourls_get_user_shorturl( bp_displayed_user_id() ) ?>
<?php if ( $shorturl ) : ?>
<dt><?php _e( 'Quick Link', 'cacap' ) ?></dt>
<dd><a href="http://cuny.is/<?php echo esc_attr( $shorturl ) ?>">http://cuny.is/<?php echo esc_html( $shorturl ) ?></a></dd>
<?php endif ?>
<?php endif ?>
</dl>
</div>
<?php endif ?>

0 comments on commit b808525

Please sign in to comment.