Merge pull request #17 from Rumperuu/fix/timelines

Fix timelines, disable taxonomy description HTML tag stripping
This commit is contained in:
Ben Goldsworthy 2021-01-21 12:05:19 +00:00 committed by GitHub
commit a730fd73ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 145 additions and 23 deletions

View file

@ -718,3 +718,8 @@ function display_companies() {
add_action( 'wp_ajax_display_companies', 'display_companies' );
add_action( 'wp_ajax_nopriv_display_companies', 'display_companies' );
// allow html in category and taxonomy descriptions
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'pre_link_description', 'wp_filter_kses' );
remove_filter( 'pre_link_notes', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' );

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() );
$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;
?>
[
'<?php echo ( $isCurrent ) ? 'Current' : 'Past'; ?>',

View file

@ -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,9 +1,8 @@
<?php
/**
* The template for showing experience (by organisation).
/**
* The template for showing items indexed by organisation.
*
* @package WordPress
* @subpackage Omphaloskepsis
* @package Omphaloskepsis
* @since Omphaloskepsis 1.0
*/
?>
@ -64,9 +63,11 @@
}
}
$title = html_entity_decode( get_the_title() );
$endDate = get_post_meta( get_the_ID(), 'end-date', true );
$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>
</section>
<?php endif; ?>
<section id="related" class="row">