Fix timeline date coercion, styling, add external/empty href styling

This commit is contained in:
Ben Goldsworthy 2021-01-21 12:03:14 +00:00
parent 60fe2b6e6f
commit 877aa0efc0
4 changed files with 140 additions and 23 deletions

64
icons/extlink.svg Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: CorelDRAW X5 -->
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ns1="http://sozi.baierouge.fr"
xmlns:cc="http://web.resource.org/cc/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
style="fill-rule:evenodd;text-rendering:geometricPrecision;image-rendering:optimizeQuality;clip-rule:evenodd;shape-rendering:geometricPrecision"
xml:space="preserve"
viewBox="0 0 1395 1395"
>
<defs
>
<style
type="text/css"
>
.fil0 {fill:black;fill-rule:nonzero}
</style
>
</defs
>
<g
id="Layer_x0020_1"
>
<path
class="fil0"
d="m848 995v-447h-549l157 157c21 21 21 54 0 75l-327 327 161 161 327-327c21-21 54-21 75 0l157 157v-102zm-442-553v-389c0-29 24-53 53-53h884c29 0 53 24 53 53v1172c0 29-24 53-53 53h-884c-9 0-17-2-24-6l-108 108c-21 21-54 21-75 0l-236-236c-21-21-21-54 0-75l327-327-210-210c-33-33-10-90 37-90h235zm106 0h405c13 4 23 15 30 26h206c70 0 70 106 0 106h-199v128h199c70 0 70 106 0 106h-199v128h199c70 0 70 106 0 106h-199v128h336v-1066h-778v336zm23 729h238l-119-119-119 119zm115-831c-70 0-70-106 0-106h503c70 0 70 106 0 106h-503z"
/>
</g
>
<metadata
><rdf:RDF
><cc:Work
><dc:format
>image/svg+xml</dc:format
><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/><cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/><dc:publisher
><cc:Agent
rdf:about="http://openclipart.org/"
><dc:title
>Openclipart</dc:title
></cc:Agent
></dc:publisher
></cc:Work
><cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/></cc:License
></rdf:RDF
></metadata
></svg
>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -92,7 +92,9 @@ get_header(); ?>
$loop->the_post();
?>
<?php
$isCurrent = ( get_post_meta( get_the_ID(), 'end-date', true ) ) ? false : true;
$endDate = get_post_meta( get_the_ID(), 'end-date', true );
$isCurrent = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? true : false;
$company = wp_get_object_terms(
get_the_ID(),
'company',
@ -100,9 +102,10 @@ get_header(); ?>
'fields' => 'names',
)
);
$title = html_entity_decode( get_the_title() );
$start = get_the_date();
$end = ( ! get_post_meta( get_the_ID(), 'end-date', true ) ) ? date( 'c' ) : get_post_meta( get_the_ID(), 'end-date', true );
$title = htmlspecialchars_decode(strip_tags( get_the_title() ));
$start = get_the_date();
$end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate;
?>
[
'<?php echo ( $isCurrent ) ? 'Current' : 'Past'; ?>',

View File

@ -320,7 +320,7 @@ html {
align-items: center;
grid-template-areas:
"post-content-header post-content"
" post-meta post-content"
" post-meta post-content"
" . post-content";
}
}
@ -957,6 +957,7 @@ body > header h1 {
#split-page > #wrapper > header {
text-align: center;
margin-right: 4em;
}
#split-page > #wrapper > header > div {
opacity: 0.8;
@ -1272,6 +1273,7 @@ a:hover, a:focus {
display: block;
margin: auto;
min-height: 200px;
max-width: 950%;
}
.loading {
@ -1396,3 +1398,45 @@ table:not(.footnote-reference-container) td {
padding: 0.5em 1em;
text-align: left;
}
details {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 50%;
text-align: left;
border: none;
outline: none;
transition: 0.4s;
margin-bottom: 0.5em;
}
details[open] {
background-color: #ccc;
}
/* Style the accordion panel. Note: hidden by default */
details p:first-child {
padding-top: 1em;
}
details p {
line-height: 1em;
}
summary {
font-size: 1.1em;
font-weight: bold;
}
/* shorter version!
a[href*="//"]:not([href*="bengoldsworthy.net"]):after {
content: url('./icons/extlink.svg');
margin: 0 0 0 5px;
}
a[href="#"] {
color: red;
}
*/

View File

@ -1,11 +1,10 @@
<?php
/**
* The template for showing experience (by organisation).
*
* @package WordPress
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0
*/
/**
* The template for showing items indexed by organisation.
*
* @package Omphaloskepsis
* @since Omphaloskepsis 1.0
*/
?>
<?php get_header(); ?>
@ -63,10 +62,12 @@
$lowestDepthCompany = $i++;
}
}
$endDate = get_post_meta( get_the_ID(), 'end-date', true );
$title = html_entity_decode( get_the_title() );
$title = htmlspecialchars_decode(strip_tags( get_the_title() ));
$start = get_the_date();
$end = ( ! get_post_meta( get_the_ID(), 'end-date', true ) ) ? date( 'c' ) : get_post_meta( get_the_ID(), 'end-date', true );
$end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate;
echo "[ '" . html_entity_decode( $companies[ $lowestDepthCompany ]->name ) . "', '$title', new Date('$start'), new Date('$end') ],\n";
endwhile;
?>
@ -74,10 +75,17 @@
// Draws the table, then resizes the element height and re-draws it
// to avoid needing to scroll vertically.
chart.draw(dataTable);
var realheight = parseInt(jQuery("#timeline div:first-child div:first-child div:first-child svg").attr("height"))+70;
var options = {};
options.height = realheight;
var rowHeight = 15;
var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50;
var options = {
tooltip: {isHtml: true},
timeline: {
showRowLabels: true,
},
height: chartHeight,
width: '100%',
};
chart.draw(dataTable, options);
}
</script>
@ -111,11 +119,9 @@
</section>
<?php if ( $loop->have_posts() ) : ?>
<section id="timeline">
<div class="row">
<div id="timeline" class="col-12">
<img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif">
</div>
</div>
<div id="timeline" class="col-12">
<img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif">
</div>
</section>
<?php endif; ?>
<section id="related" class="row">