From 3b93d163cce4b551a192a47d67d6f88d4569cd1b Mon Sep 17 00:00:00 2001 From: andrewmbacon Date: Tue, 11 Aug 2015 08:35:51 -0400 Subject: [PATCH] ucpeople integration --- inc/people-grid.php | 4 +- js/cs.js | 584 +++++++++++++++++++++++--------------------- sass/_ucpeople.scss | 14 ++ single-person.php | 142 ++++++++--- style.css | 14 ++ style.scss | 3 +- 6 files changed, 452 insertions(+), 309 deletions(-) create mode 100644 sass/_ucpeople.scss diff --git a/inc/people-grid.php b/inc/people-grid.php index c5e3fb8..c8252a6 100644 --- a/inc/people-grid.php +++ b/inc/people-grid.php @@ -23,9 +23,9 @@ echo ''; if (in_array('photo', $information_to_display)) { - echo ''; + echo '
'; the_post_thumbnail('large'); - echo ''; + echo '
'; }; if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){ diff --git a/js/cs.js b/js/cs.js index 9e4244e..f0056db 100644 --- a/js/cs.js +++ b/js/cs.js @@ -1,276 +1,310 @@ -jQuery(document).ready(function($) { - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Link Flags - Scans all the links in the main content area, and adds icons to any links that lead to other websites, or to downloadable documents. - by Andrew Bacon - May 2014 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - - var url = location.href - var urlExploded = url.split('/') - var site = urlExploded[2] - var extensions = ['3g2', '3gp', 'avi', 'doc', 'docx', 'dotx', 'gif', 'jpg', 'jpeg', 'm4a', 'mid', 'midi', 'mov', 'mp3', 'mp4', 'mpg', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'xls', 'xlsx', 'wav', 'wmv', 'zip', 'vsd'] - - function scanLinks(){ - if(undefined == $(this).attr('href')) return; - var href = $(this).attr('href').toLowerCase() - var img = $(this).children('img').length - var base = null - var last = null - var ext = null - var flag = null - - // if (((href.charAt(0) != '?') || (href.charAt(0) != '#')) && img == 0 ){ - if (href.charAt(0) != '#' && img == 0){ - if (href.charAt(0) != '/'){ - var hrefExploded = href.split('/') - base = hrefExploded[2] - - - - //console.log('checking to see if it might be a file...') - last = hrefExploded[hrefExploded.length-1] || '' - var lastExploded = last.split('.') - - if (lastExploded[1]){ - //console.log('ok, so there was a dot in the last value of the url.') - $.each(extensions, function(index, value){ - - if (value == lastExploded[1]){ - flag = $('') - //console.log('match!') - ext = lastExploded[1] - //console.log('ext:'+ext) - flag.append('.'+ext) - } - }) - } - if (flag != null){ - $(this).append(flag) - } - if (base != site && base != null) { - - //console.log('external link detected, adding icon...') - // is external, and is not a named anchor tag - var icon = '' - $(this).addClass('external').append(icon) - } - } - } - } - - // This will only scan elements in these sections of the site. - - var elementsToScan = [ - '#comments', - '#site-navigation', - 'article.page' - ] - - $.each(elementsToScan, function(index, value){ - $(value+' a').each(scanLinks) - }) - - - /* ----- - - UUP Style Help - - ----- */ - $('.uup-list .has-image').each(function(){ - //console.log('has image...'); - var text = $(this).find('.uup-text'); - var img = $(this).find('img:first'); - //console.log(text); - //console.log(img); - var textHeight = text.height(); - var imgHeight = img.outerHeight(); - //console.log(textHeight); - //console.log(imgHeight); - - if (imgHeight > textHeight){ - var diff = imgHeight - textHeight; - text.css('padding-top', diff/2); - } - }); - $('.uup-index-table .table-has-image').each(function(){ - //console.log('has image...'); - var text = $(this).find('.uup-name'); - var img = $(this).find('.uup-table-thumbnail'); - //console.log(text); - //console.log(img); - var textHeight = text.height(); - var imgHeight = img.outerHeight(); - //console.log(textHeight); - //console.log(imgHeight); - if (imgHeight > textHeight){ - //console.log('img bigger...'); - var diff = imgHeight - textHeight; - text.css('cssText', 'padding-bottom:'+ diff + 'px!important' ); - } - }); - - - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Nav: Neverwrap - Keeps navigation items from wrapping to a second line when there are too many. - Emulates browser tabs. - by Andrew Bacon - May 2014 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - /* - function calcNavWidth(){ - var width = 0 - $('#primary-nav > ul > li > a').each(function(){ - console.log('this width: '+$(this).outerWidth()) - width = width + $(this).outerWidth() - }) - console.log('width: '+width) - return width - } - - var containerWidth = $('#site-navigation').outerWidth(); - console.log('containerWidth: '+containerWidth) - - var navWidth = calcNavWidth(); - - if (navWidth > containerWidth) { - var links = $('#primary-nav > ul > li > a').length - console.log('links: '+links) - var width = 100/links - console.log('width: '+width) - $('#primary-nav').addClass('neverwrap') - - - $('#primary-nav > ul > li').each(function(){ - console.log('meep') - $(this).width(width+'%') - }) - - } - /**/ - /* - - Need some kind of a way to... - - when the size of each one gets too low, and is useless... - - actually rewrite the markup, and place the last few categories under a "more" item. Clicking that exposes a second nav bar. - - - */ - - - - /* - - SIMPLE ACCESSIBILITY TESTER - - by Andrew Bacon - This plugin runs simple tests on a site, and adds distinct visual styles to flawed content when they fail. - - */ - function imageWarning(e){ - var block = $('
') - block.addClass('alert alert-danger accessibility-fail-msg') - //console.log(e.width()) - block.width(e.width+'px') - - var icon = $('') - icon.addClass('glyphicon glyphicon-ban-circle') - - var msg = $('') - msg.append(' This image needs a valid Alt tag. ') - - - block.append(icon).append(msg) - $(e).after(block) - } - $('#page img').each(function(){ - alt = $(this).attr('alt') - if (alt){ - alt = alt.toLowerCase() - //console.log('alt='+alt) - if (alt.indexOf('.jpg') >= 0 || alt.indexOf('.png') >= 0 || alt.indexOf('.gif') >= 0 ){ - $(this).addClass('accessibility-fail') - imageWarning(this) - } - } else { - $(this).addClass('accessibility-fail') - imageWarning(this) - } - }) - // adds default bootstrap styles to all tables. - $('#page table').each(function(){ - $(this).addClass('table'); - }) - - /**/ - - - -// STICKY FOOTER -// measures height of the page, and applies a class to absolute position the footer, or not. -// on short pages, it sticks; on tall pages, it doesn't. - -function stickyFoot(){ - if (document.getElementById('page')!=null && document.getElementById('footers') !=null){ - $('body').removeClass('sticky'); - var wrapperH = $('#page').outerHeight(); - var wpadminbarH = $('#wpadminbar').outerHeight(); - var ucheaderH = $('#uc-header').outerHeight(); - var footerH = $('#footers').outerHeight(); - var windowH = window.innerHeight; - var gformH = 0; - $('.gform_wrapper').each(function(){ - gformH = gformH + $(this).outerHeight(); - }); - windowH = windowH - wpadminbarH - ucheaderH; - if(windowH>=wrapperH){ - $('body').addClass('sticky'); - } - } -} -$(document).ready(function(){ - stickyFoot(); -}); -$(window).resize(function() { - stickyFoot(); -}); -$(window).load(function() { - stickyFoot(); -}); -function onElementHeightChange(elm, callback){ - var lastHeight = elm.clientHeight, newHeight; - (function run(){ - newHeight = elm.clientHeight; - if( lastHeight != newHeight ) - callback(); - lastHeight = newHeight; - - if( elm.onElementHeightChangeTimer ) - clearTimeout(elm.onElementHeightChangeTimer); - - elm.onElementHeightChangeTimer = setTimeout(run, 200); - })(); -} - - -onElementHeightChange(document.body, function(){ - stickyFoot(); -}); - -$('.panel, .collapse').on('shown.bs.collapse', function (e) { - stickyFoot(); -}) -$('.panel, .collapse').on('hidden.bs.collapse', function (e) { - stickyFoot(); -}) - +jQuery(document).ready(function($) { + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Link Flags + Scans all the links in the main content area, and adds icons to any links that lead to other websites, or to downloadable documents. + by Andrew Bacon + May 2014 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + var url = location.href + var urlExploded = url.split('/') + var site = urlExploded[2] + var extensions = ['3g2', '3gp', 'avi', 'doc', 'docx', 'dotx', 'gif', 'jpg', 'jpeg', 'm4a', 'mid', 'midi', 'mov', 'mp3', 'mp4', 'mpg', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'xls', 'xlsx', 'wav', 'wmv', 'zip', 'vsd'] + + function scanLinks(){ + if(undefined == $(this).attr('href')) return; + var href = $(this).attr('href').toLowerCase() + var img = $(this).children('img').length + var base = null + var last = null + var ext = null + var flag = null + + // if (((href.charAt(0) != '?') || (href.charAt(0) != '#')) && img == 0 ){ + if (href.charAt(0) != '#' && img == 0){ + if (href.charAt(0) != '/'){ + var hrefExploded = href.split('/') + base = hrefExploded[2] + + + + //console.log('checking to see if it might be a file...') + last = hrefExploded[hrefExploded.length-1] || '' + var lastExploded = last.split('.') + + if (lastExploded[1]){ + //console.log('ok, so there was a dot in the last value of the url.') + $.each(extensions, function(index, value){ + + if (value == lastExploded[1]){ + flag = $('') + //console.log('match!') + ext = lastExploded[1] + //console.log('ext:'+ext) + flag.append('.'+ext) + } + }) + } + if (flag != null){ + $(this).append(flag) + } + if (base != site && base != null) { + + //console.log('external link detected, adding icon...') + // is external, and is not a named anchor tag + var icon = '' + $(this).addClass('external').append(icon) + } + } + } + } + + // This will only scan elements in these sections of the site. + + var elementsToScan = [ + '#comments', + '#site-navigation', + 'article.page' + ] + + $.each(elementsToScan, function(index, value){ + $(value+' a').each(scanLinks) + }) + + + /* ----- + + UUP Style Help + + ----- */ + $('.uup-list .has-image').each(function(){ + //console.log('has image...'); + var text = $(this).find('.uup-text'); + var img = $(this).find('img:first'); + //console.log(text); + //console.log(img); + var textHeight = text.height(); + var imgHeight = img.outerHeight(); + //console.log(textHeight); + //console.log(imgHeight); + + if (imgHeight > textHeight){ + var diff = imgHeight - textHeight; + text.css('padding-top', diff/2); + } + }); + $('.uup-index-table .table-has-image').each(function(){ + //console.log('has image...'); + var text = $(this).find('.uup-name'); + var img = $(this).find('.uup-table-thumbnail'); + //console.log(text); + //console.log(img); + var textHeight = text.height(); + var imgHeight = img.outerHeight(); + //console.log(textHeight); + //console.log(imgHeight); + if (imgHeight > textHeight){ + //console.log('img bigger...'); + var diff = imgHeight - textHeight; + text.css('cssText', 'padding-bottom:'+ diff + 'px!important' ); + } + }); + + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Nav: Neverwrap + Keeps navigation items from wrapping to a second line when there are too many. + Emulates browser tabs. + by Andrew Bacon + May 2014 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + /* + function calcNavWidth(){ + var width = 0 + $('#primary-nav > ul > li > a').each(function(){ + console.log('this width: '+$(this).outerWidth()) + width = width + $(this).outerWidth() + }) + console.log('width: '+width) + return width + } + + var containerWidth = $('#site-navigation').outerWidth(); + console.log('containerWidth: '+containerWidth) + + var navWidth = calcNavWidth(); + + if (navWidth > containerWidth) { + var links = $('#primary-nav > ul > li > a').length + console.log('links: '+links) + var width = 100/links + console.log('width: '+width) + $('#primary-nav').addClass('neverwrap') + + + $('#primary-nav > ul > li').each(function(){ + console.log('meep') + $(this).width(width+'%') + }) + + } + /**/ + /* + + Need some kind of a way to... + + when the size of each one gets too low, and is useless... + + actually rewrite the markup, and place the last few categories under a "more" item. Clicking that exposes a second nav bar. + + + */ + + + + /* + + SIMPLE ACCESSIBILITY TESTER + + by Andrew Bacon + This plugin runs simple tests on a site, and adds distinct visual styles to flawed content when they fail. + + */ + function imageWarning(e){ + var block = $('
') + block.addClass('alert alert-danger accessibility-fail-msg') + //console.log(e.width()) + block.width(e.width+'px') + + var icon = $('') + icon.addClass('glyphicon glyphicon-ban-circle') + + var msg = $('') + msg.append(' This image needs a valid Alt tag. ') + + + block.append(icon).append(msg) + $(e).after(block) + } + $('#page img').each(function(){ + alt = $(this).attr('alt') + if (alt){ + alt = alt.toLowerCase() + //console.log('alt='+alt) + if (alt.indexOf('.jpg') >= 0 || alt.indexOf('.png') >= 0 || alt.indexOf('.gif') >= 0 ){ + $(this).addClass('accessibility-fail') + imageWarning(this) + } + } else { + $(this).addClass('accessibility-fail') + imageWarning(this) + } + }) + // adds default bootstrap styles to all tables. + $('#page table').each(function(){ + $(this).addClass('table'); + }) + + /**/ + + + +// STICKY FOOTER +// measures height of the page, and applies a class to absolute position the footer, or not. +// on short pages, it sticks; on tall pages, it doesn't. + +function stickyFoot(){ + if (document.getElementById('page')!=null && document.getElementById('footers') !=null){ + $('body').removeClass('sticky'); + var wrapperH = $('#page').outerHeight(); + var wpadminbarH = $('#wpadminbar').outerHeight(); + var ucheaderH = $('#uc-header').outerHeight(); + var footerH = $('#footers').outerHeight(); + var windowH = window.innerHeight; + var gformH = 0; + $('.gform_wrapper').each(function(){ + gformH = gformH + $(this).outerHeight(); + }); + windowH = windowH - wpadminbarH - ucheaderH; + if(windowH>=wrapperH){ + $('body').addClass('sticky'); + } + } +} +function onElementHeightChange(elm, callback){ + var lastHeight = elm.clientHeight, newHeight; + (function run(){ + newHeight = elm.clientHeight; + if( lastHeight != newHeight ) + callback(); + lastHeight = newHeight; + + if( elm.onElementHeightChangeTimer ) + clearTimeout(elm.onElementHeightChangeTimer); + + elm.onElementHeightChangeTimer = setTimeout(run, 200); + })(); +} + + +// UC People Styling + +function squareImg(img){ + +}; + + + +$(document).ready(function(){ + stickyFoot(); +}); +$(window).resize(function() { + stickyFoot(); +}); +$(window).load(function() { + stickyFoot(); + $('.page-template-user-people .uc-people .person-image').each(function(index, element) { + var imgWidth = $(this).find('img').width(); + var imgHeight = $(this).find('img').height(); + console.log(imgWidth + ' x ' + imgHeight); + var width = $(this).width(); + $(this).height(width); + + + /* + // find the shorter side, and set that to 100% of container + if (imgWidth > imgHeight) { + // horizontal images + $(this).find('img').height(width).removeAttr('height').removeAttr('width').addClass('horiztonal'); + } else { + // vertical or square images + //$(this).find('img').width(width).removeAttr('width').removeAttr('height').addClass('vertical');; + } + /**/ + $(this).css('display', 'block'); + }); + +}); +$(window).ready(function() { + +}); + + +onElementHeightChange(document.body, function(){ + stickyFoot(); +}); + +$('.panel, .collapse').on('shown.bs.collapse', function (e) { + stickyFoot(); +}) +$('.panel, .collapse').on('hidden.bs.collapse', function (e) { + stickyFoot(); +}) + }) \ No newline at end of file diff --git a/sass/_ucpeople.scss b/sass/_ucpeople.scss new file mode 100644 index 0000000..770a99f --- /dev/null +++ b/sass/_ucpeople.scss @@ -0,0 +1,14 @@ +.person-image { + display:none; + overflow: hidden; + /* + max-width:100%; + + img { + max-width:none; + max-height:none; + min-width:100%; + min-height:100%; + } + */ +} \ No newline at end of file diff --git a/single-person.php b/single-person.php index 1dd3664..7717029 100644 --- a/single-person.php +++ b/single-person.php @@ -1,37 +1,117 @@ -
-
-
- -
-
- - - - - - - - - - - -
-
-
- -
+ +
+ + +
+
+
+
+
+
+

+

+

+
+ +
+
+ '; + the_post_thumbnail(); + echo '
'; + };?> +
+ + Contact Information + '.$field_label.''; + echo '

'; + if ($field == 'email'){ + echo ''; + the_field($field); + echo ''; + } else if ($field == 'file'){ + $file = get_field($field); + $url= $file['url']; + echo ' '; + echo $file['title']; + echo ''; + } else { + the_field($field); + } + echo '


'; + } + } + */ + function displayField($field){ + if (get_field($field)){ + + $field_key = 'field_'.$field; + $field_obj = get_field_object($field_key); + $field_value = $field_obj['value']; + $field_label = $field_obj['label']; + echo ''; + echo ''; + } + } + displayField('email'); + displayField('phone'); + displayField('phone_(alternate)'); + displayField('fax'); + displayField('file'); + displayField('mailing_address'); + displayField('office_location'); + displayField('office_hours'); + displayField('courses'); + ?> +
'.$field_label.''; + if ($field == 'email'){ + echo ''; + the_field($field); + echo ''; + } else if ($field == 'file'){ + $file = get_field($field); + $url= $file['url']; + echo ' '; + echo $file['title']; + echo ''; + } else { + the_field($field); + } + echo '
+
+
+
+ + + +
+
+ +
+ +
- \ No newline at end of file + diff --git a/style.css b/style.css index 4b6ada6..efd8d95 100644 --- a/style.css +++ b/style.css @@ -7262,6 +7262,20 @@ q:before, table q:after { .page-template-page-user-profile-php .uup-user .uup-phones .uup-phone2 { display: block; } +.person-image { + display: none; + overflow: hidden; + /* + max-width:100%; + + img { + max-width:none; + max-height:none; + min-width:100%; + min-height:100%; + } + */ } + /* - - - - - - - - - - - - - - - - - - - == Calendar - - - - - - - - - - - - - - - - - - - */ diff --git a/style.scss b/style.scss index 6e5d443..3f1801a 100644 --- a/style.scss +++ b/style.scss @@ -25,6 +25,7 @@ $icon-font-path: "../../global/bootstrap-3.3.4/fonts/bootstrap/" !default; @import "sass/_accessibility.scss"; @import "sass/_table-stripper.scss"; @import "sass/_uup.scss"; +@import "sass/_ucpeople.scss"; @import "sass/_cal.scss"; @import "sass/_in-page-menus.scss"; -@import "sass/_footer.scss"; +@import "sass/_footer.scss"; \ No newline at end of file