<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[8511] sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks: Blocks: Speakers: Update to use the newly added common components.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/8511">8511</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/8511","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>vedjain</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-03-25 09:45:30 +0000 (Mon, 25 Mar 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Blocks: Speakers: Update to use the newly added common components.
Note that this is condensation of multiple commits. Original pull request: https://github.com/WordPress/wordcamp.org/pull/33
props coreymckrill, iandunn, vedjain</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcblocksjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/blocks.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentscss">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.scss</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontrolsjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersinspectorcontrolsjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersspeakersselectjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerstoolbarjs">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesspeakersphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksviewspeakersphp">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/view/speakers.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditscss">sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.scss</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcblocksjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/blocks.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/blocks.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/blocks.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,10 +6,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import * as sessions from './sessions/';
</ins><span class="cx" style="display: block; padding: 0 10px"> import * as speakers from './speakers/';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import * as sponsors from './sponsors/';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> [
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sessions,
</ins><span class="cx" style="display: block; padding: 0 10px"> speakers,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sponsors,
</ins><span class="cx" style="display: block; padding: 0 10px"> ].forEach( ( { name, settings } ) => {
</span><span class="cx" style="display: block; padding: 0 10px"> registerBlockType( name, settings );
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,53 +8,103 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const { Disabled } = wp.components;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { Component, Fragment, RawHTML } = wp.element;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { Component, Fragment } = wp.element;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { decodeEntities } = wp.htmlEntities;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { __, _n, sprintf } = wp.i18n;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { __, _n } = wp.i18n;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> import AvatarImage from '../shared/avatar';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { ItemTitle, ItemHTMLContent } from '../shared/block-content';
+import { tokenSplit, arrayTokenReplace } from '../shared/i18n';
+import GridContentLayout from '../shared/grid-layout/block-content';
</ins><span class="cx" style="display: block; padding: 0 10px"> import './block-content.scss';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function SpeakerSessions( { speaker, tracks } ) {
+ const sessions = get( speaker, '_embedded.sessions', [] );
+
+ let output = ( <Fragment>{ null }</Fragment> );
+
+ if ( sessions.length ) {
+ output = (
+ <div className={ classnames( 'wordcamp-item-meta', 'wordcamp-speaker-sessions' ) }>
+ <h4 className="wordcamp-speaker-sessions-heading">
+ { _n( 'Session', 'Sessions', sessions.length, 'wordcamporg' ) }
+ </h4>
+
+ <ul className="wordcamp-speaker-sessions-list">
+ { sessions.map( ( session ) =>
+ <li
+ key={ session.slug }
+ className="wordcamp-speaker-session-content"
+ >
+ <Disabled>
+ <a
+ className="wordcamp-speaker-session-link"
+ href={ session.link }
+ >
+ { decodeEntities( session.title.rendered.trim() ) || __( '(Untitled)', 'wordcamporg' ) }
+ </a>
+ <span className="wordcamp-speaker-session-info">
+ { session.session_track.length &&
+ arrayTokenReplace(
+ /* translators: 1: A date; 2: A time; 3: A location; */
+ tokenSplit( __( '%1$s at %2$s in %3$s', 'wordcamporg' ) ),
+ decodeEntities( session.session_date_time.date ),
+ decodeEntities( session.session_date_time.time ),
+ get( tracks.find( ( value ) => {
+ const [ firstTrackId ] = session.session_track;
+ return parseInt( value.id ) === firstTrackId;
+ } ), 'name' )
+ )
+ }
+ { ! session.session_track.length &&
+ arrayTokenReplace(
+ /* translators: 1: A date; 2: A time; */
+ tokenSplit( __( '%1$s at %2$s', 'wordcamporg' ), ),
+ decodeEntities( session.session_date_time.date ),
+ decodeEntities( session.session_date_time.time )
+ )
+ }
+ </span>
+ </Disabled>
+ </li>
+ ) }
+ </ul>
+ </div>
+ );
+ }
+
+ return output;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> class SpeakersBlockContent extends Component {
</span><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><span class="cx" style="display: block; padding: 0 10px"> const { attributes, speakerPosts, tracks } = this.props;
</span><span class="cx" style="display: block; padding: 0 10px"> const {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- layout, grid_columns, className,
</del><span class="cx" style="display: block; padding: 0 10px"> show_avatars, avatar_size, avatar_align,
</span><span class="cx" style="display: block; padding: 0 10px"> content, excerpt_more, show_session,
</span><span class="cx" style="display: block; padding: 0 10px"> } = attributes;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const containerClasses = [
- 'wordcamp-speakers-block',
- 'layout-' + layout,
- className,
- ];
-
- if ( 'grid' === layout ) {
- containerClasses.push( 'grid-columns-' + Number( grid_columns ) );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <ul className={ classnames( containerClasses ) }>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <GridContentLayout
+ { ...this.props }
+ >
</ins><span class="cx" style="display: block; padding: 0 10px"> { speakerPosts.map( ( post ) =>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div
</ins><span class="cx" style="display: block; padding: 0 10px"> key={ post.slug }
</span><span class="cx" style="display: block; padding: 0 10px"> className={ classnames(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wordcamp-speaker',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wordcamp-speaker-' + decodeEntities( post.slug ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wordcamp-clearfix'
</del><span class="cx" style="display: block; padding: 0 10px"> ) }
</span><span class="cx" style="display: block; padding: 0 10px"> >
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <h3 className="wordcamp-speaker-name-heading">
- <Disabled>
- <a href={ post.link }>
- { decodeEntities( post.title.rendered.trim() ) || __( '(Untitled)', 'wordcamporg' ) }
- </a>
- </Disabled>
- </h3>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ItemTitle
+ className="wordcamp-speaker-title"
+ headingLevel={ 3 }
+ title={ post.title.rendered.trim() }
+ link={ post.link }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> { show_avatars &&
</span><span class="cx" style="display: block; padding: 0 10px"> <div className={ classnames( 'wordcamp-speaker-avatar-container', 'align-' + decodeEntities( avatar_align ) ) }>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,83 +122,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> { ( 'none' !== content ) &&
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div className={ classnames( 'wordcamp-speaker-content', 'wordcamp-speaker-content-' + decodeEntities( content ) ) }>
- { 'full' === content &&
- <Disabled>
- <RawHTML children={ post.content.rendered.trim() } />
- <p className="wordcamp-speaker-permalink">
- <a href={ post.link }>
- { __( 'Visit speaker page', 'wordcamporg' ) }
- </a>
- </p>
- </Disabled>
- }
- { 'excerpt' === content &&
- <Disabled>
- <RawHTML children={ post.excerpt.rendered.trim() } />
- { excerpt_more &&
- <p className="wordcamp-speaker-permalink">
- <a href={ post.link }>
- { __( 'Read more', 'wordcamporg' ) }
- </a>
- </p>
- }
- </Disabled>
- }
- </div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ItemHTMLContent
+ className={ classnames( 'wordcamp-speaker-content-' + decodeEntities( content ) ) }
+ content={ 'full' === content ? post.content.rendered.trim() : post.excerpt.rendered.trim() }
+ link={ ( 'full' === content || excerpt_more ) ? post.link : null }
+ linkText={ 'full' === content ? __( 'Visit session page', 'wordcamporg' ) : __( 'Read more', 'wordcamporg' ) }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { true === show_session && post._embedded.sessions &&
- <Fragment>
- <h4 className="wordcamp-speaker-session-heading">
- { _n( 'Session', 'Sessions', post._embedded.sessions.length, 'wordcamporg' ) }
- </h4>
-
- <ul className="wordcamp-speaker-session-list">
- { post._embedded.sessions.map( ( session ) =>
- <li
- key={ session.slug }
- className="wordcamp-speaker-session-content"
- >
- <Disabled>
- <a
- className="wordcamp-speaker-session-link"
- href={ session.link }
- >
- { decodeEntities( session.title.rendered.trim() ) || __( '(Untitled)', 'wordcamporg' ) }
- </a>
- <br />
- <span className="wordcamp-speaker-session-info">
- { session.session_track.length &&
- sprintf(
- /* translators: 1: A date; 2: A time; 3: A location; */
- __( '%1$s at %2$s in %3$s', 'wordcamporg' ),
- session.session_date_time.date,
- session.session_date_time.time,
- get( tracks.find( ( value ) => {
- const [ firstTrackId ] = session.session_track;
- return parseInt( value.id ) === firstTrackId;
- } ), 'name' )
- )
- }
- { ! session.session_track.length &&
- sprintf(
- /* translators: 1: A date; 2: A time; */
- __( '%1$s at %2$s', 'wordcamporg' ),
- session.session_date_time.date,
- session.session_date_time.time
- )
- }
- </span>
- </Disabled>
- </li>
- ) }
- </ul>
- </Fragment>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ { true === show_session &&
+ <SpeakerSessions
+ speaker={ post }
+ tracks={ tracks }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </li>,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ </div>,
</ins><span class="cx" style="display: block; padding: 0 10px"> ) }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </ul>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ </GridContentLayout>
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontentscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.scss 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-content.scss 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,56 +1,3 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.wordcamp-clearfix:after {
- content: "";
- display: table;
- clear: both;
-}
-
-.wordcamp-speakers-block {
- /* The double-ampersand defeats an overzealous ul rule in Core's editor-blocks.css. */
- /* https://css-tricks.com/the-sass-ampersand/#article-header-id-11 */
- &#{&},
- .block-editor &#{&} {
- list-style: none;
- margin: 0 0 1em 0;
- }
-
- &.layout-list > li {
- margin-bottom: 1em;
- &:last-child {
- margin-bottom: 0;
- }
- }
-
- @media ( min-width: 400px ) {
- &.layout-grid {
- display: grid;
- grid-template-columns: repeat( 2, 1fr );
- grid-column-gap: 1em;
- grid-row-gap: 1em;
-
- /* Ensure columns maintain equal widths. */
- /* https://stackoverflow.com/a/43312314 */
- min-height: 0;
- min-width: 0;
- & .wordcamp-speaker {
- overflow: hidden;
- min-width: 0;
- }
- }
- }
-
- @media ( min-width: 600px ) {
- &.layout-grid.grid-columns-3 {
- grid-template-columns: repeat( 3, 1fr );
- }
- }
-
- @media ( min-width: 800px ) {
- &.layout-grid.grid-columns-4 {
- grid-template-columns: repeat( 4, 1fr );
- }
- }
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .wordcamp-speaker-session-list {
</span><span class="cx" style="display: block; padding: 0 10px"> /* See note above about the double-ampersand. */
</span><span class="cx" style="display: block; padding: 0 10px"> ul#{&},
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersblockcontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/block-controls.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,37 +1,37 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * External dependencies
+ */
+import classnames from 'classnames';
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const { Button, Placeholder, Spinner } = wp.components;
-const { Component, Fragment } = wp.element;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const { Button, Placeholder } = wp.components;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { __ } = wp.i18n;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { BlockControls, PlaceholderNoContent, PlaceholderSpecificMode } from '../shared/block-controls';
</ins><span class="cx" style="display: block; padding: 0 10px"> import SpeakersBlockContent from './block-content';
</span><span class="cx" style="display: block; padding: 0 10px"> import SpeakersSelect from './speakers-select';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const data = window.WordCampBlocks.speakers || {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const LABEL = __( 'Speakers', 'wordcamporg' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class SpeakersBlockControls extends Component {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class SpeakersBlockControls extends BlockControls {
</ins><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { attributes, setAttributes, speakerPosts } = this.props;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { icon, attributes, setAttributes, speakerPosts } = this.props;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { mode } = attributes;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { mode: modeOptions = {} } = data.options;
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const hasPosts = Array.isArray( speakerPosts ) && speakerPosts.length;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( mode && ! hasPosts ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <Placeholder
- icon="megaphone"
- label={ __( 'Speakers', 'wordcamporg' ) }
- >
- { ! Array.isArray( speakerPosts ) ?
- <Spinner /> :
- __( 'No posts found.', 'wordcamporg' )
- }
- </Placeholder>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <PlaceholderNoContent
+ icon={ icon }
+ label={ LABEL }
+ loading={ ! Array.isArray( speakerPosts ) }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,49 +44,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'specific_posts' :
- const postsLabel = modeOptions.find( ( modeOption ) => {
- return 'specific_posts' === modeOption.value;
- } ).label;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'wcb_speaker' :
+ case 'wcb_speaker_group' :
</ins><span class="cx" style="display: block; padding: 0 10px"> output = (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <Fragment>
- <SpeakersBlockContent { ...this.props } />
- <Placeholder
- icon="megaphone"
- label={ postsLabel }
- >
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <PlaceholderSpecificMode
+ label={ this.getModeLabel( mode ) }
+ icon={ icon }
+ content={
+ <SpeakersBlockContent { ...this.props } />
+ }
+ placeholderChildren={
</ins><span class="cx" style="display: block; padding: 0 10px"> <SpeakersSelect { ...this.props } />
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </Placeholder>
- </Fragment>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'specific_terms' :
- const termsLabel = modeOptions.find( ( modeOption ) => {
- return 'specific_terms' === modeOption.value;
- } ).label;
-
- output = (
- <Fragment>
- <SpeakersBlockContent { ...this.props } />
- <Placeholder
- icon="megaphone"
- label={ termsLabel }
- >
- <SpeakersSelect { ...this.props } />
- </Placeholder>
- </Fragment>
- );
- break;
-
</del><span class="cx" style="display: block; padding: 0 10px"> default :
</span><span class="cx" style="display: block; padding: 0 10px"> output = (
</span><span class="cx" style="display: block; padding: 0 10px"> <Placeholder
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- icon="megaphone"
- label={ __( 'Speakers', 'wordcamporg' ) }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ className={ classnames( 'wordcamp-block-edit-placeholder', 'wordcamp-block-edit-placeholder-no-mode' ) }
+ icon={ icon }
+ label={ LABEL }
</ins><span class="cx" style="display: block; padding: 0 10px"> >
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div className="wordcamp-block-speakers-mode-option">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div className="wordcamp-block-edit-mode-option">
</ins><span class="cx" style="display: block; padding: 0 10px"> <Button
</span><span class="cx" style="display: block; padding: 0 10px"> isDefault
</span><span class="cx" style="display: block; padding: 0 10px"> isLarge
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,13 +75,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> setAttributes( { mode: 'all' } );
</span><span class="cx" style="display: block; padding: 0 10px"> } }
</span><span class="cx" style="display: block; padding: 0 10px"> >
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { modeOptions.find( ( modeOption ) => {
- return 'all' === modeOption.value;
- } ).label }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ { this.getModeLabel( 'all' ) }
</ins><span class="cx" style="display: block; padding: 0 10px"> </Button>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div className="wordcamp-block-speakers-mode-option">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div className="wordcamp-block-edit-mode-option">
</ins><span class="cx" style="display: block; padding: 0 10px"> <SpeakersSelect
</span><span class="cx" style="display: block; padding: 0 10px"> label={ __( 'Choose specific speakers or groups', 'wordcamporg' ) }
</span><span class="cx" style="display: block; padding: 0 10px"> { ...this.props }
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,8 +17,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> import SpeakersBlockControls from './block-controls';
</span><span class="cx" style="display: block; padding: 0 10px"> import SpeakersInspectorControls from './inspector-controls';
</span><span class="cx" style="display: block; padding: 0 10px"> import SpeakersToolbar from './toolbar';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import './edit.scss';
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const blockData = window.WordCampBlocks.speakers || {};
+
+const SPEAKERS_ICON = 'megaphone';
</ins><span class="cx" style="display: block; padding: 0 10px"> const MAX_POSTS = 100;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const ALL_POSTS_QUERY = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +38,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class SpeakersEdit extends Component {
</span><span class="cx" style="display: block; padding: 0 10px"> constructor( props ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- super( props );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ super();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.state = {
</span><span class="cx" style="display: block; padding: 0 10px"> allSpeakerPosts : null,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,7 +73,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><span class="cx" style="display: block; padding: 0 10px"> <Fragment>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <SpeakersBlockControls { ...this.props } { ...this.state } />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <SpeakersBlockControls
+ icon={ SPEAKERS_ICON }
+ { ...this.props }
+ { ...this.state }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> { mode &&
</span><span class="cx" style="display: block; padding: 0 10px"> <Fragment>
</span><span class="cx" style="display: block; padding: 0 10px"> <SpeakersInspectorControls { ...this.props } />
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,7 +90,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const speakersSelect = ( select, props ) => {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { mode, post_ids, term_ids, sort } = props.attributes;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { mode, item_ids, sort } = props.attributes;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { getEntityRecords } = select( 'core' );
</span><span class="cx" style="display: block; padding: 0 10px"> const [ orderby, order ] = split( sort, '_', 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,17 +102,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> context : 'view',
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'specific_posts' === mode && Array.isArray( post_ids ) ) {
- args.include = post_ids;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( Array.isArray( item_ids ) ) {
+ switch ( mode ) {
+ case 'wcb_speaker':
+ args.include = item_ids;
+ break;
+ case 'wcb_speaker_group':
+ args.speaker_group = item_ids;
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'specific_terms' === mode && Array.isArray( term_ids ) ) {
- args.speaker_group = term_ids;
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> const speakersQuery = pickBy( args, ( value ) => ! isUndefined( value ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ blockData,
</ins><span class="cx" style="display: block; padding: 0 10px"> speakerPosts : getEntityRecords( 'postType', 'wcb_speaker', speakersQuery ),
</span><span class="cx" style="display: block; padding: 0 10px"> tracks : getEntityRecords( 'taxonomy', 'wcb_track', { per_page: MAX_POSTS } ),
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerseditscss"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.scss 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/edit.scss 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,40 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.wordcamp-block-speakers-mode-option {
- flex-basis: 100%;
- padding: 0.5em;
-}
-.wordcamp-speakers-select-option {
- display: flex;
- align-items: center;
-}
-.wordcamp-speakers-select-loading-container,
-.wordcamp-speakers-select-option-icon-container {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 24px;
- height: 24px;
-}
-.wordcamp-speakers-select-option-icon-container {
- background-color: #f3f3f4;
-}
-.wordcamp-speakers-select-loading-container .components-spinner {
- margin: 0;
-}
-.wordcamp-speakers-select-option-label {
- margin: 0 0.5em;
-}
-.wordcamp-speakers-select-option-label-term-count {
- font-size: 0.6em;
- display: inline-block;
- border-radius: 50%;
- background-color: #f3f3f4;
- width: 2.2em;
- height: 2.2em;
- margin: 0 0.5em;
- text-align: center;
- line-height: 2.2em;
- vertical-align: text-top;
-}
-.wordcamp-components-versatile-select {
- width: 100%;
-}
</del></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersinspectorcontrolsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/inspector-controls.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,9 +11,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> import AvatarSizeControl from '../shared/avatar-size';
</span><span class="cx" style="display: block; padding: 0 10px"> import ImageAlignmentControl from '../shared/image-alignment';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import GridInspectorControl from '../shared/grid-layout/inspector-control';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const data = window.WordCampBlocks.speakers || {};
-
</del><span class="cx" style="display: block; padding: 0 10px"> const DEFAULT_SCHEMA = {
</span><span class="cx" style="display: block; padding: 0 10px"> grid_columns: {
</span><span class="cx" style="display: block; padding: 0 10px"> default : 2,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,27 +34,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class SpeakerInspectorControls extends Component {
</span><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { attributes, setAttributes } = this.props;
- const { layout, grid_columns, show_avatars, avatar_size, avatar_align, content, excerpt_more, show_session, sort } = attributes;
- const { schema = DEFAULT_SCHEMA, options = DEFAULT_OPTIONS } = data;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { attributes, setAttributes, blockData } = this.props;
+ const { show_avatars, avatar_size, avatar_align, content, excerpt_more, show_session, sort } = attributes;
+ const { schema = DEFAULT_SCHEMA, options = DEFAULT_OPTIONS } = blockData;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><span class="cx" style="display: block; padding: 0 10px"> <InspectorControls>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { 'grid' === layout &&
- <PanelBody title={ __( 'Layout', 'wordcamporg' ) } initialOpen={ true }>
- <PanelRow>
- <RangeControl
- label={ __( 'Grid Columns', 'wordcamporg' ) }
- value={ Number( grid_columns ) }
- min={ Number( schema.grid_columns.minimum ) }
- max={ Number( schema.grid_columns.maximum ) }
- initialPosition={ Number( schema.grid_columns.default ) }
- onChange={ ( value ) => setAttributes( { grid_columns: value } ) }
- />
- </PanelRow>
- </PanelBody>
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <GridInspectorControl
+ { ...this.props }
+ />
</ins><span class="cx" style="display: block; padding: 0 10px"> <PanelBody title={ __( 'Avatar Settings', 'wordcamporg' ) } initialOpen={ true }>
</span><span class="cx" style="display: block; padding: 0 10px"> <PanelRow>
</span><span class="cx" style="display: block; padding: 0 10px"> <ToggleControl
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakersspeakersselectjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/speakers-select.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * External dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { includes } from 'lodash';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { get, includes } from 'lodash';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress dependencies
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,20 +15,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Internal dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> import AvatarImage from '../shared/avatar';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import VersatileSelect from '../shared/versatile-select';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import ItemSelect from '../shared/item-select';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class SpeakersSelect extends Component {
</span><span class="cx" style="display: block; padding: 0 10px"> constructor( props ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- super( props );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ super();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.state = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- posts : [],
- terms : [],
- loading : true,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wcb_speaker : [],
+ wcb_speaker_group : [],
+ loading : true,
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.buildSelectOptions = this.buildSelectOptions.bind( this );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.isOptionDisabled = this.isOptionDisabled.bind( this );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> componentWillMount() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,13 +41,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return {
</span><span class="cx" style="display: block; padding: 0 10px"> label : decodeEntities( post.title.rendered.trim() ) || __( '(Untitled)', 'wordcamporg' ),
</span><span class="cx" style="display: block; padding: 0 10px"> value : post.id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type : 'post',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type : 'wcb_speaker',
</ins><span class="cx" style="display: block; padding: 0 10px"> avatar : post.avatar_urls[ '24' ],
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( this.isStillMounted ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.setState( { posts } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.setState( { wcb_speaker: posts } );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,13 +58,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return {
</span><span class="cx" style="display: block; padding: 0 10px"> label : decodeEntities( term.name ) || __( '(Untitled)', 'wordcamporg' ),
</span><span class="cx" style="display: block; padding: 0 10px"> value : term.id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type : 'term',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type : 'wcb_speaker_group',
</ins><span class="cx" style="display: block; padding: 0 10px"> count : term.count,
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( this.isStillMounted ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.setState( { terms } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.setState( { wcb_speaker_group: terms } );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,108 +79,53 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> buildSelectOptions( mode ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { posts, terms } = this.state;
</del><span class="cx" style="display: block; padding: 0 10px"> const options = [];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! mode || 'specific_terms' === mode ) {
- options.push( {
- label : __( 'Groups', 'wordcamporg' ),
- options : terms,
- } );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const labels = {
+ wcb_speaker : __( 'Speakers', 'wordcamporg' ),
+ wcb_speaker_group : __( 'Groups', 'wordcamporg' ),
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! mode || 'specific_posts' === mode ) {
- options.push( {
- label : __( 'Speakers', 'wordcamporg' ),
- options : posts,
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( const type in this.state ) {
+ if ( this.state.hasOwnProperty( type ) && ( ! mode || type === mode ) && this.state[ type ].length ) {
+ options.push( {
+ label : labels[ type ],
+ options : this.state[ type ],
+ } );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return options;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isOptionDisabled( option, selected ) {
- const { mode } = this.props.attributes;
- let chosen;
-
- if ( 'loading' === option.type ) {
- return true;
- }
-
- if ( Array.isArray( selected ) && selected.length ) {
- chosen = selected[ 0 ].type;
- }
-
- if ( 'specific_terms' === mode && 'post' === option.type ) {
- return true;
- }
-
- if ( 'specific_posts' === mode && 'term' === option.type ) {
- return true;
- }
-
- return chosen && chosen !== option.type;
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><span class="cx" style="display: block; padding: 0 10px"> const { label, attributes, setAttributes } = this.props;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { mode, post_ids, term_ids } = attributes;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { mode, item_ids } = attributes;
</ins><span class="cx" style="display: block; padding: 0 10px"> const options = this.buildSelectOptions( mode );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> let value = [];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'specific_posts' === mode && options.length ) {
- value = options[ 0 ].options.filter( ( option ) => {
- return includes( post_ids, option.value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( mode && item_ids.length ) {
+ const modeOptions = get( options, '[0].options', [] );
+
+ value = modeOptions.filter( ( option ) => {
+ return includes( item_ids, option.value );
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( 'specific_terms' === mode && options.length ) {
- value = options[ 0 ].options.filter( ( option ) => {
- return includes( term_ids, option.value );
- } );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <VersatileSelect
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ItemSelect
</ins><span class="cx" style="display: block; padding: 0 10px"> className="wordcamp-speakers-select"
</span><span class="cx" style="display: block; padding: 0 10px"> label={ label }
</span><span class="cx" style="display: block; padding: 0 10px"> value={ value }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- onChange={ ( selectedOptions ) => {
- const newValue = selectedOptions.map( ( option ) => option.value );
-
- if ( newValue.length ) {
- const chosen = selectedOptions[ 0 ].type;
-
- switch ( chosen ) {
- case 'post' :
- setAttributes( {
- mode : 'specific_posts',
- post_ids : newValue,
- } );
- break;
-
- case 'term' :
- setAttributes( {
- mode : 'specific_terms',
- term_ids : newValue,
- } );
- break;
- }
- } else {
- setAttributes( {
- mode : '',
- post_ids : [],
- term_ids : [],
- } );
- }
- } }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ buildSelectOptions={ this.buildSelectOptions }
+ onChange={ ( changed ) => setAttributes( changed ) }
+ mode={ mode }
</ins><span class="cx" style="display: block; padding: 0 10px"> selectProps={ {
</span><span class="cx" style="display: block; padding: 0 10px"> isLoading : this.state.loading,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- options : options,
- isMulti : true,
- isOptionDisabled : this.isOptionDisabled,
</del><span class="cx" style="display: block; padding: 0 10px"> formatGroupLabel : ( groupData ) => {
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span className="wordcamp-speakers-select-option-group-label">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <span className="wordcamp-item-select-option-group-label">
</ins><span class="cx" style="display: block; padding: 0 10px"> { groupData.label }
</span><span class="cx" style="display: block; padding: 0 10px"> </span>
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -201,10 +145,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> let image, content;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'post' :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'wcb_speaker' :
</ins><span class="cx" style="display: block; padding: 0 10px"> image = (
</span><span class="cx" style="display: block; padding: 0 10px"> <AvatarImage
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- className="wordcamp-speakers-select-option-avatar"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ className="wordcamp-item-select-option-avatar"
</ins><span class="cx" style="display: block; padding: 0 10px"> name={ label }
</span><span class="cx" style="display: block; padding: 0 10px"> size={ 24 }
</span><span class="cx" style="display: block; padding: 0 10px"> url={ avatar }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -211,17 +155,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> content = (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span className="wordcamp-speakers-select-option-label">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <span className="wordcamp-item-select-option-label">
</ins><span class="cx" style="display: block; padding: 0 10px"> { label }
</span><span class="cx" style="display: block; padding: 0 10px"> </span>
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'term' :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'wcb_speaker_group' :
</ins><span class="cx" style="display: block; padding: 0 10px"> image = (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div className="wordcamp-speakers-select-option-icon-container">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div className="wordcamp-item-select-option-icon-container">
</ins><span class="cx" style="display: block; padding: 0 10px"> <Dashicon
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- className="wordcamp-speakers-select-option-icon"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ className="wordcamp-item-select-option-icon"
</ins><span class="cx" style="display: block; padding: 0 10px"> icon={ 'megaphone' }
</span><span class="cx" style="display: block; padding: 0 10px"> size={ 16 }
</span><span class="cx" style="display: block; padding: 0 10px"> />
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -228,9 +172,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> content = (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span className="wordcamp-speakers-select-option-label">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <span className="wordcamp-item-select-option-label">
</ins><span class="cx" style="display: block; padding: 0 10px"> { label }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span className="wordcamp-speakers-select-option-label-term-count">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <span className="wordcamp-item-select-option-label-term-count">
</ins><span class="cx" style="display: block; padding: 0 10px"> { count }
</span><span class="cx" style="display: block; padding: 0 10px"> </span>
</span><span class="cx" style="display: block; padding: 0 10px"> </span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,7 +183,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div className="wordcamp-speakers-select-option">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div className="wordcamp-item-select-option">
</ins><span class="cx" style="display: block; padding: 0 10px"> { image }
</span><span class="cx" style="display: block; padding: 0 10px"> { content }
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksassetssrcspeakerstoolbarjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/assets/src/speakers/toolbar.js 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,13 +5,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> const { BlockControls } = wp.editor;
</span><span class="cx" style="display: block; padding: 0 10px"> const { Component } = wp.element;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const data = window.WordCampBlocks.speakers || {};
-
</del><span class="cx" style="display: block; padding: 0 10px"> class SpeakersToolbar extends Component {
</span><span class="cx" style="display: block; padding: 0 10px"> render() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { attributes, setAttributes } = this.props;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { attributes, setAttributes, blockData } = this.props;
</ins><span class="cx" style="display: block; padding: 0 10px"> const { layout } = attributes;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const { layout: layoutOptions = {} } = data.options;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const { layout: layoutOptions = {} } = blockData.options;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return (
</span><span class="cx" style="display: block; padding: 0 10px"> <BlockControls>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksincludesspeakersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/includes/speakers.php 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,10 +1,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Blocks\Speakers;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordCamp\Blocks;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) || die();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use WP_Post;
-use WordCamp\Blocks;
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Register block types and enqueue scripts.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,11 +33,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function render( $attributes ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $html = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> $defaults = wp_list_pluck( get_attributes_schema(), 'default' );
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes = wp_parse_args( $attributes, $defaults );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $speakers = get_speaker_posts( $attributes );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $speakers = get_speaker_posts( $attributes );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $sessions = [];
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $speakers ) && true === $attributes['show_session'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $sessions = get_speaker_sessions( wp_list_pluck( $speakers, 'ID' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,20 +44,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $container_classes = [
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wordcamp-block',
+ 'wordcamp-block-post-list',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wordcamp-speakers-block',
</span><span class="cx" style="display: block; padding: 0 10px"> 'layout-' . sanitize_html_class( $attributes['layout'] ),
</span><span class="cx" style="display: block; padding: 0 10px"> sanitize_html_class( $attributes['className'] ),
</span><span class="cx" style="display: block; padding: 0 10px"> ];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( 'grid' === $attributes['layout'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $container_classes[] = 'grid-columns-' . absint( $attributes['grid_columns'] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> $container_classes = implode( ' ', $container_classes );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ob_start();
- require Blocks\PLUGIN_DIR . 'view/speakers.php';
- $html = ob_get_clean();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $attributes['mode'] ) {
+ ob_start();
+ require Blocks\PLUGIN_DIR . 'view/speakers.php';
+ $html = ob_get_clean();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $html;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,16 +104,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( $attributes['mode'] ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'specific_posts':
- $post_args['post__in'] = $attributes['post_ids'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'wcb_speaker':
+ $post_args['post__in'] = $attributes['item_ids'];
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'specific_terms':
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'wcb_speaker_group':
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_args['tax_query'] = [
</span><span class="cx" style="display: block; padding: 0 10px"> [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'taxonomy' => 'wcb_speaker_group',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'taxonomy' => $attributes['mode'],
</ins><span class="cx" style="display: block; padding: 0 10px"> 'field' => 'id',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'terms' => $attributes['term_ids'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'terms' => $attributes['item_ids'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,7 +171,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => wp_list_pluck( get_options( 'mode' ), 'value' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'post_ids' => [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'item_ids' => [
</ins><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'array',
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => [],
</span><span class="cx" style="display: block; padding: 0 10px"> 'items' => [
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -176,13 +178,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'term_ids' => [
- 'type' => 'array',
- 'default' => [],
- 'items' => [
- 'type' => 'integer',
- ],
- ],
</del><span class="cx" style="display: block; padding: 0 10px"> 'sort' => [
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'enum' => wp_list_pluck( get_options( 'sort' ), 'value' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -296,11 +291,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> [
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => _x( 'Choose speakers', 'mode option', 'wordcamporg' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => 'specific_posts',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => 'wcb_speaker',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> [
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => _x( 'Choose groups', 'mode option', 'wordcamporg' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => 'specific_terms',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => 'wcb_speaker_group',
</ins><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> 'sort' => [
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -333,28 +328,3 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $options;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-/**
- * Get the full content of a post, ignoring more and noteaser tags and pagination.
- *
- * This works similarly to `the_content`, including applying filters, but:
- * - It skips all of the logic in `get_the_content` that deals with tags like <!--more--> and
- * <!--noteaser-->, as well as pagination and global state variables like `$page`, `$more`, and
- * `$multipage`.
- * - It returns a string of content, rather than echoing it.
- *
- * @param int|WP_Post $post Post ID or post object.
- *
- * @return string The full, filtered post content.
- */
-function get_all_the_content( $post ) {
- $post = get_post( $post );
-
- $content = $post->post_content;
-
- /** This filter is documented in wp-includes/post-template.php */
- $content = apply_filters( 'the_content', $content );
- $content = str_replace( ']]>', ']]>', $content );
-
- return $content;
-}
</del></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentmupluginsblocksviewspeakersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/view/speakers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/view/speakers.php 2019-03-25 09:45:18 UTC (rev 8510)
+++ sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/blocks/view/speakers.php 2019-03-25 09:45:30 UTC (rev 8511)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Blocks\Speakers;
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) || die();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use function WordCamp\Blocks\Shared\{ get_all_the_content };
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** @var array $attributes */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var array $speakers */
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var array $sessions */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,8 +14,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( ! empty( $speakers ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <ul class="<?php echo esc_attr( $container_classes ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php foreach ( $speakers as $speaker ) : setup_postdata( $speaker ); // phpcs:ignore Squiz.ControlStructures.ControlSignature ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li class="wordcamp-speaker wordcamp-speaker-<?php echo sanitize_html_class( $speaker->post_name ); ?> wordcamp-clearfix">
- <h3 class="wordcamp-speaker-name-heading">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li class="wordcamp-block-post-list-item wordcamp-speaker wordcamp-speaker-<?php echo sanitize_html_class( $speaker->post_name ); ?> wordcamp-clearfix">
+ <h3 class="wordcamp-item-title wordcamp-speaker-title">
</ins><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( get_permalink( $speaker ) ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo get_the_title( $speaker ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </a>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,10 +41,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( 'none' !== $attributes['content'] ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div class="wordcamp-speaker-content wordcamp-speaker-content-<?php echo esc_attr( $attributes['content'] ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="wordcamp-item-content wordcamp-speaker-content-<?php echo esc_attr( $attributes['content'] ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( 'full' === $attributes['content'] ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo wpautop( get_all_the_content( $speaker ) ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p class="wordcamp-speaker-permalink">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="wordcamp-item-permalink">
</ins><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( get_permalink( $speaker ) ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php esc_html_e( 'Visit speaker page', 'wordcamporg' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </a>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php elseif ( 'excerpt' === $attributes['content'] ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php wpautop( the_excerpt() ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( true === $attributes['excerpt_more'] ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p class="wordcamp-speaker-permalink">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="wordcamp-item-permalink">
</ins><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( get_permalink( $speaker ) ); ?>" class="wordcamp-speaker-permalink">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php esc_html_e( 'Read more', 'wordcamporg' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </a>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,43 +63,45 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( true === $attributes['show_session'] && ! empty( $sessions[ $speaker->ID ] ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <h4 class="wordcamp-speaker-session-heading">
- <?php echo esc_html( _n( 'Session', 'Sessions', count( $sessions[ $speaker->ID ] ), 'wordcamporg' ) ); ?>
- </h4>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="wordcamp-item-meta wordcamp-speaker-sessions">
+ <h4 class="wordcamp-speaker-sessions-heading">
+ <?php echo esc_html( _n( 'Session', 'Sessions', count( $sessions[ $speaker->ID ] ), 'wordcamporg' ) ); ?>
+ </h4>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <ul class="wordcamp-speaker-session-list">
- <?php foreach ( $sessions[ $speaker->ID ] as $session ) :
- $tracks = get_the_terms( $session, 'wcb_track' );
- ?>
- <li class="wordcamp-speaker-session-content">
- <a class="wordcamp-speaker-session-link" href="<?php echo esc_url( get_permalink( $session ) ); ?>">
- <?php echo get_the_title( $session ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
- </a>
- <span class="wordcamp-speaker-session-info">
- <?php if ( ! is_wp_error( $tracks ) && ! empty( $tracks ) ) : ?>
- <?php
- printf(
- /* translators: 1: A date; 2: A time; 3: A location; */
- esc_html__( '%1$s at %2$s in %3$s', 'wordcamporg' ),
- esc_html( date_i18n( get_option( 'date_format' ), $session->_wcpt_session_time ) ),
- esc_html( date_i18n( get_option( 'time_format' ), $session->_wcpt_session_time ) ),
- esc_html( $tracks[0]->name )
- );
- ?>
- <?php else : ?>
- <?php
- printf(
- /* translators: 1: A date; 2: A time; */
- esc_html__( '%1$s at %2$s', 'wordcamporg' ),
- esc_html( date_i18n( get_option( 'date_format' ), $session->_wcpt_session_time ) ),
- esc_html( date_i18n( get_option( 'time_format' ), $session->_wcpt_session_time ) )
- );
- ?>
- <?php endif; ?>
- </span>
- </li>
- <?php endforeach; ?>
- </ul>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ul class="wordcamp-speaker-sessions-list">
+ <?php foreach ( $sessions[ $speaker->ID ] as $session ) :
+ $tracks = get_the_terms( $session, 'wcb_track' );
+ ?>
+ <li class="wordcamp-speaker-session-content">
+ <a class="wordcamp-speaker-session-link" href="<?php echo esc_url( get_permalink( $session ) ); ?>">
+ <?php echo get_the_title( $session ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
+ </a>
+ <span class="wordcamp-speaker-session-info">
+ <?php if ( ! is_wp_error( $tracks ) && ! empty( $tracks ) ) : ?>
+ <?php
+ printf(
+ /* translators: 1: A date; 2: A time; 3: A location; */
+ esc_html__( '%1$s at %2$s in %3$s', 'wordcamporg' ),
+ esc_html( date_i18n( get_option( 'date_format' ), $session->_wcpt_session_time ) ),
+ esc_html( date_i18n( get_option( 'time_format' ), $session->_wcpt_session_time ) ),
+ esc_html( $tracks[0]->name )
+ );
+ ?>
+ <?php else : ?>
+ <?php
+ printf(
+ /* translators: 1: A date; 2: A time; */
+ esc_html__( '%1$s at %2$s', 'wordcamporg' ),
+ esc_html( date_i18n( get_option( 'date_format' ), $session->_wcpt_session_time ) ),
+ esc_html( date_i18n( get_option( 'time_format' ), $session->_wcpt_session_time ) )
+ );
+ ?>
+ <?php endif; ?>
+ </span>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+ </div>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </li>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endforeach; wp_reset_postdata(); // phpcs:ignore Generic.Formatting.DisallowMultipleStatements,Squiz.PHP.EmbeddedPhp ?>
</span></span></pre>
</div>
</div>
</body>
</html>