Browse Source

More cleanup (header and JS).

pull/43/head
Ned Zimmerman 7 years ago
parent
commit
59633ff08c
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 3
      assets/scripts/aldine.js
  2. 204
      assets/scripts/routes/catalog.js
  3. 109
      assets/scripts/routes/common.js
  4. 94
      assets/scripts/util/Router.js
  5. 11
      assets/scripts/util/camelCase.js
  6. 2
      assets/styles/aldine.scss
  7. 220
      assets/styles/layouts/_header.scss
  8. 4
      dist/mix-manifest.json
  9. 2
      dist/scripts/aldine.js
  10. 2
      dist/styles/aldine.css
  11. 22
      header.php
  12. 4
      inc/actions/namespace.php
  13. 12
      inc/filters/namespace.php
  14. 1
      package.json
  15. 7
      searchform.php
  16. 2
      yarn.lock

3
assets/scripts/aldine.js

@ -1,6 +1,3 @@
// import external dependencies
import 'jquery';
// import local dependencies // import local dependencies
import Router from './util/Router'; import Router from './util/Router';
import common from './routes/common'; import common from './routes/common';

204
assets/scripts/routes/catalog.js

@ -4,108 +4,110 @@ const Isotope = require( 'isotope-layout' );
export default { export default {
init() { init() {
// JavaScript to be fired on the catalog page // JavaScript to be fired on the catalog page
jQueryBridget( 'isotope', Isotope, $ ); jQuery( $ => {
let $grid = $( '.books' ); jQueryBridget( 'isotope', Isotope, $ );
$grid.isotope( { let $grid = $( '.books' );
itemSelector: '.book', $grid.isotope( {
getSortData: { itemSelector: '.book',
title: '.title a', getSortData: {
subject: '[data-subject]', title: '.title a',
latest: '[data-date-published]', subject: '[data-subject]',
}, latest: '[data-date-published]',
sortAscending: { },
title: true, sortAscending: {
subject: true, title: true,
latest: false, subject: true,
}, latest: false,
} ); },
$( '.filters > a' ).click( e => { } );
e.preventDefault(); $( '.filters > a' ).click( e => {
$( '.filters' ).toggleClass( 'is-active' ); e.preventDefault();
$( '.filter-groups > div' ).removeClass( 'is-active' ); $( '.filters' ).toggleClass( 'is-active' );
} ); $( '.filter-groups > div' ).removeClass( 'is-active' );
$( '.filter-groups .subjects > a' ).click( e => { } );
e.preventDefault(); $( '.filter-groups .subjects > a' ).click( e => {
let id = $( e.currentTarget ).attr( 'href' ); e.preventDefault();
$( `.filter-groups .subjects:not(${id})` ).removeClass( 'is-active' ); let id = $( e.currentTarget ).attr( 'href' );
$( `.filter-groups ${id}` ).toggleClass( 'is-active' ); $( `.filter-groups .subjects:not(${id})` ).removeClass( 'is-active' );
} ); $( `.filter-groups ${id}` ).toggleClass( 'is-active' );
$( '.licenses > a' ).click( e => { } );
e.preventDefault(); $( '.licenses > a' ).click( e => {
let id = $( e.currentTarget ).attr( 'href' ); e.preventDefault();
$( id ).toggleClass( 'is-active' ); let id = $( e.currentTarget ).attr( 'href' );
} ); $( id ).toggleClass( 'is-active' );
$( '.subjects .filter-list a' ).click( e => { } );
e.preventDefault(); $( '.subjects .filter-list a' ).click( e => {
if ( $( e.currentTarget ).hasClass( 'is-active' ) ) { e.preventDefault();
$( '.subjects .filter-list a' ).removeClass( 'is-active' ); if ( $( e.currentTarget ).hasClass( 'is-active' ) ) {
$( '.subjects' ).removeClass( 'has-active-child' ); $( '.subjects .filter-list a' ).removeClass( 'is-active' );
} else { $( '.subjects' ).removeClass( 'has-active-child' );
$( '.subjects .filter-list a' ).removeClass( 'is-active' ); } else {
$( '.subjects .filter-list a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$( '.subjects' ).removeClass( 'has-active-child' );
$( e.currentTarget )
.parent()
.parent()
.parent( '.subjects' )
.addClass( 'has-active-child' );
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
} );
$( '.licenses .filter-list a' ).click( e => {
e.preventDefault();
if ( $( e.currentTarget ).hasClass( 'is-active' ) ) {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( '.licenses' ).removeClass( 'has-active-child' );
} else {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$( '.licenses' ).addClass( 'has-active-child' );
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
} );
$( '.sort > a' ).click( e => {
e.preventDefault();
$( '.sort' ).toggleClass( 'is-active' );
} );
$( '.sorts a' ).click( e => {
e.preventDefault();
let sortBy = $( e.currentTarget ).attr( 'data-sort' );
$( '.sorts a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' ); $( e.currentTarget ).addClass( 'is-active' );
$( '.subjects' ).removeClass( 'has-active-child' ); $grid.isotope( { sortBy: sortBy } );
$( e.currentTarget ) } );
.parent()
.parent()
.parent( '.subjects' )
.addClass( 'has-active-child' );
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
} );
$( '.licenses .filter-list a' ).click( e => {
e.preventDefault();
if ( $( e.currentTarget ).hasClass( 'is-active' ) ) {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( '.licenses' ).removeClass( 'has-active-child' );
} else {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$( '.licenses' ).addClass( 'has-active-child' );
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
} );
$( '.sort > a' ).click( e => {
e.preventDefault();
$( '.sort' ).toggleClass( 'is-active' );
} );
$( '.sorts a' ).click( e => {
e.preventDefault();
let sortBy = $( e.currentTarget ).attr( 'data-sort' );
$( '.sorts a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$grid.isotope( { sortBy: sortBy } );
} ); } );
}, },
finalize() {}, finalize() {},

109
assets/scripts/routes/common.js

@ -3,66 +3,73 @@ import * as Cookies from 'js-cookie';
export default { export default {
init() { init() {
// JavaScript to be fired on all pages // JavaScript to be fired on all pages
$( 'body' ) jQuery( $ => {
.removeClass( 'no-js' ) $( 'body' )
.addClass( 'js' ); .removeClass( 'no-js' )
$( document ).ready( function () { .addClass( 'js' );
// Fontsize handler $( document ).ready( function () {
if ( Cookies.get( 'a11y-larger-fontsize' ) === '1' ) { // Fontsize handler
$( 'html' ).addClass( 'fontsize' ); if ( Cookies.get( 'a11y-larger-fontsize' ) === '1' ) {
$( '#is_normal_fontsize' )
.attr( 'id', 'is_large_fontsize' )
.attr( 'aria-checked', true )
.addClass( 'active' )
.text( PB_A11y.decrease_label )
.attr( 'title', PB_A11y.decrease_label );
}
$( '.toggle-fontsize' ).on( 'click', function () {
if ( $( this ).attr( 'id' ) === 'is_normal_fontsize' ) {
$( 'html' ).addClass( 'fontsize' ); $( 'html' ).addClass( 'fontsize' );
$( this ) $( '#is_normal_fontsize' )
.attr( 'id', 'is_large_fontsize' ) .attr( 'id', 'is_large_fontsize' )
.attr( 'aria-checked', true ) .attr( 'aria-checked', true )
.addClass( 'active' ) .addClass( 'active' )
.text( PB_A11y.decrease_label ) .text( PB_A11y.decrease_label )
.attr( 'title', PB_A11y.decrease_label ); .attr( 'title', PB_A11y.decrease_label );
Cookies.set( 'a11y-larger-fontsize', '1', { expires: 365, path: '' } );
return false;
} else {
$( 'html' ).removeClass( 'fontsize' );
$( this )
.attr( 'id', 'is_normal_fontsize' )
.removeAttr( 'aria-checked' )
.removeClass( 'active' )
.text( PB_A11y.increase_label )
.attr( 'title', PB_A11y.increase_label );
Cookies.set( 'a11y-larger-fontsize', '0', { expires: 365, path: '' } );
return false;
} }
} );
// Sets a -1 tabindex to ALL sections for .focus()-ing $( '.toggle-fontsize' ).on( 'click', function () {
let sections = document.getElementsByTagName( 'section' ); if ( $( this ).attr( 'id' ) === 'is_normal_fontsize' ) {
for ( let i = 0, max = sections.length; i < max; i++ ) { $( 'html' ).addClass( 'fontsize' );
sections[i].setAttribute( 'tabindex', -1 ); $( this )
sections[i].className += ' focusable'; .attr( 'id', 'is_large_fontsize' )
} .attr( 'aria-checked', true )
.addClass( 'active' )
.text( PB_A11y.decrease_label )
.attr( 'title', PB_A11y.decrease_label );
Cookies.set( 'a11y-larger-fontsize', '1', {
expires: 365,
path: '',
} );
return false;
} else {
$( 'html' ).removeClass( 'fontsize' );
$( this )
.attr( 'id', 'is_normal_fontsize' )
.removeAttr( 'aria-checked' )
.removeClass( 'active' )
.text( PB_A11y.increase_label )
.attr( 'title', PB_A11y.increase_label );
Cookies.set( 'a11y-larger-fontsize', '0', {
expires: 365,
path: '',
} );
return false;
}
} );
// If there is a '#' in the URL (someone linking directly to a page with an anchor), go directly to that area and focus is // Sets a -1 tabindex to ALL sections for .focus()-ing
// Thanks to WebAIM.org for this idea let sections = document.getElementsByTagName( 'section' );
if ( document.location.hash && document.location.hash !== '#' ) { for ( let i = 0, max = sections.length; i < max; i++ ) {
let anchorUponArrival = document.location.hash; sections[i].setAttribute( 'tabindex', -1 );
setTimeout( function () { sections[i].className += ' focusable';
$( anchorUponArrival ).scrollTo( { duration: 1500 } ); }
$( anchorUponArrival ).focus();
}, 100 ); // If there is a '#' in the URL (someone linking directly to a page with an anchor), go directly to that area and focus is
} // Thanks to WebAIM.org for this idea
} ); if ( document.location.hash && document.location.hash !== '#' ) {
$( '.js-header-menu-toggle' ).click( event => { let anchorUponArrival = document.location.hash;
event.preventDefault(); setTimeout( function () {
$( event.currentTarget ).toggleClass( '--active' ); $( anchorUponArrival ).scrollTo( { duration: 1500 } );
$( '.js-header-nav' ).toggleClass( '--visible' ); $( anchorUponArrival ).focus();
}, 100 );
}
} );
$( '.js-header-nav-toggle' ).click( event => {
event.preventDefault();
$( '.header__nav' ).toggleClass( 'header__nav--active' );
} );
} ); } );
}, },
finalize() { finalize() {

94
assets/scripts/util/Router.js

@ -9,55 +9,57 @@ import camelCase from './camelCase';
* Add additional events for more control over timing e.g. a finalize event * Add additional events for more control over timing e.g. a finalize event
*/ */
class Router { class Router {
/**
* Create a new Router
* @param {Object} routes
*/
constructor( routes ) {
this.routes = routes;
}
/** /**
* Create a new Router * Fire Router events
* @param {Object} routes * @param {string} route DOM-based route derived from body classes (`<body class="...">`)
*/ * @param {string} [event] Events on the route. By default, `init` and `finalize` events are called.
constructor(routes) { * @param {string} [arg] Any custom argument to be passed to the event.
this.routes = routes; */
} fire( route, event = 'init', arg ) {
const fire =
route !== '' &&
this.routes[route] &&
typeof this.routes[route][event] === 'function';
if ( fire ) {
this.routes[route][event]( arg );
}
}
/** /**
* Fire Router events * Automatically load and fire Router events
* @param {string} route DOM-based route derived from body classes (`<body class="...">`) *
* @param {string} [event] Events on the route. By default, `init` and `finalize` events are called. * Events are fired in the following order:
* @param {string} [arg] Any custom argument to be passed to the event. * * common init
*/ * * page-specific init
fire(route, event = 'init', arg) { * * page-specific finalize
const fire = route !== '' && this.routes[route] && typeof this.routes[route][event] === 'function'; * * common finalize
if (fire) { */
this.routes[route][event](arg); loadEvents() {
} // Fire common init JS
} this.fire( 'common' );
/** // Fire page-specific init JS, and then finalize JS
* Automatically load and fire Router events document.body.className
* .toLowerCase()
* Events are fired in the following order: .replace( /-/g, '_' )
* * common init .split( /\s+/ )
* * page-specific init .map( camelCase )
* * page-specific finalize .forEach( className => {
* * common finalize this.fire( className );
*/ this.fire( className, 'finalize' );
loadEvents() { } );
// Fire common init JS
this.fire('common');
// Fire page-specific init JS, and then finalize JS // Fire common finalize JS
document.body.className this.fire( 'common', 'finalize' );
.toLowerCase() }
.replace(/-/g, '_')
.split(/\s+/)
.map(camelCase)
.forEach((className) => {
this.fire(className);
this.fire(className, 'finalize');
});
// Fire common finalize JS
this.fire('common', 'finalize');
}
} }
export default Router export default Router;

11
assets/scripts/util/camelCase.js

@ -3,7 +3,10 @@
* @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD * @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD
* @return {string} String converted to camel-case, e.g., camelCaseIsHard * @return {string} String converted to camel-case, e.g., camelCaseIsHard
*/ */
export default str => `${str.charAt(0).toLowerCase()}${str.replace(/[\W_]/g, '|').split('|') export default str =>
.map(part => `${part.charAt(0).toUpperCase()}${part.slice(1)}`) `${str.charAt( 0 ).toLowerCase()}${str
.join('') .replace( /[\W_]/g, '|' )
.slice(1)}`; .split( '|' )
.map( part => `${part.charAt( 0 ).toUpperCase()}${part.slice( 1 )}` )
.join( '' )
.slice( 1 )}`;

2
assets/styles/aldine.scss

@ -14,7 +14,7 @@
// @import "components/forms"; // @import "components/forms";
// @import "components/grid"; // @import "components/grid";
// @import "components/wp-classes"; // @import "components/wp-classes";
// @import "layouts/header"; @import "layouts/header";
// @import "layouts/sidebar"; // @import "layouts/sidebar";
// @import "layouts/footer"; // @import "layouts/footer";
// @import "layouts/pages"; // @import "layouts/pages";

220
assets/styles/layouts/_header.scss

@ -1,214 +1,42 @@
.banner { .home .header {
background-position: bottom; background-position: bottom;
background-size: cover; background-size: cover;
height: 560px;
.container { &__title {
display: flex; font-family: $font-family-sans-serif;
flex-direction: column; font-size: 1.875rem;
justify-content: space-between; margin-top: 3rem;
align-items: center; margin-bottom: 0;
height: 560px; text-align: center;
width: 100%;
max-width: 100%; max-width: 100%;
max-width: 1440px;
}
.toggle {
display: block;
position: absolute;
top: 30px;
right: 17px;
width: 25px;
height: 20px;
z-index: 99;
text-indent: -9999em;
&__icon {
display: block;
position: absolute;
top: 7px;
width: 25px;
height: 3px;
background: var(--primary, $brand-primary);
&::before,
&::after {
width: 25px;
height: 3px;
content: '';
background: var(--primary, $brand-primary);
}
&::before {
position: absolute;
top: -7px;
right: 0;
}
&::after {
position: absolute;
top: 7px;
right: 0;
}
}
&--active {
.toggle__icon {
background: var(--primary-fg, $white);
&::before,
&::after {
background: var(--primary-fg, $white);
}
}
}
} }
&__brand { &__description {
display: block; font-family: $font-family-sans-serif;
align-self: flex-start; font-size: 1.125rem;
width: 6.5625rem; margin-bottom: 0;
height: auto; text-align: center;
margin: 30px 0 0 17px; max-width: 100%;
svg,
img {
width: auto;
max-width: 100%;
height: auto;
}
} }
&__navigation { @media #{$breakpoint-large} {
display: flex; height: 880px;
position: absolute;
flex-direction: column;
justify-content: center;
align-items: flex-start;
top: 0;
width: 100%;
height: 560px;
margin: 0 0 0 -100%;
padding: 0 17px;
background: transparent;
a {
display: none;
font-family: $font-family-sans-serif;
font-size: rem(24);
line-height: (80/24);
color: var(--primary-fg, $white);
letter-spacing: 0;
}
.sep {
display: none;
}
&--visible {
margin: 0;
padding: 0 52px;
z-index: 1;
background: var(--primary, $brand-primary);
a {
display: block;
width: 100%;
border-bottom: solid 1px var(--primary-fg, $white);
&:last-child { &__title {
border-bottom: 0; font-size: 4.5rem;
}
}
} }
}
&__branding {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 364px;
text-align: center;
p { &__description {
font-family: $font-family-sans-serif; font-size: 1.875rem;
} }
} }
} }
.page:not(.home) .banner__branding { .page .header {
display: none; // TODO
} }
@media #{$breakpoint-large} { .page.catalog .header {
.banner { // TODO
.container {
height: 880px;
margin: 0 auto;
}
.toggle {
display: none;
}
&__brand {
align-self: center;
width: 16.5625rem;
height: auto;
margin-top: 40px;
}
&__navigation {
top: 40px;
height: 40px;
max-width: 1440px;
margin: 0 auto;
flex-direction: row;
justify-content: flex-start;
align-items: center;
a {
display: inline-block;
font-size: rem(18);
color: var(--header-text, $black);
line-height: normal;
&:hover,
&:focus {
color: var(--primary, $brand-primary);
}
}
&--catalog {
margin-right: auto;
}
&--contact {
margin: 0 1em 0 auto;
}
&--sep {
display: inline-block;
margin: 0 0.5em;
}
}
&__branding {
height: 576px;
p {
font-size: rem(30);
letter-spacing: 0.75px;
line-height: (40/30);
}
}
h1 {
margin-bottom: rem(32);
font-size: rem(72);
line-height: (40/72);
letter-spacing: rem(1.8);
}
}
} }

4
dist/mix-manifest.json vendored

@ -1,5 +1,5 @@
{ {
"/scripts/aldine.js": "/scripts/aldine.js?id=f0380c51980a33b2d33c", "/scripts/aldine.js": "/scripts/aldine.js?id=af09fa97e83d238ec459",
"/styles/aldine.css": "/styles/aldine.css?id=405ee7591545ea8b1977", "/styles/aldine.css": "/styles/aldine.css?id=28b42418cb02cfbe2c49",
"/scripts/customizer.js": "/scripts/customizer.js?id=f1f1f4225cba4c1b35f2" "/scripts/customizer.js": "/scripts/customizer.js?id=f1f1f4225cba4c1b35f2"
} }

2
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

2
dist/styles/aldine.css vendored

File diff suppressed because one or more lines are too long

22
header.php

@ -35,44 +35,44 @@
</svg> </svg>
<div id="page" class="site"> <div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'pressbooks-aldine' ); ?></a> <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'pressbooks-aldine' ); ?></a>
<header class="header" role="banner" style="background-image: url(<?php
<header id="masthead" class="header header--root" role="banner" style="background-image: url(<?php
if ( is_front_page() ) { if ( is_front_page() ) {
echo( get_header_image() ); echo( get_header_image() );
} else { } else {
echo get_template_directory_uri() . '/dist/images/catalog-header.jpg'; echo get_template_directory_uri() . '/dist/images/catalog-header.jpg';
} ?>);"> } ?>);">
<div class="header__inner"> <div class="header__inside">
<div class="header__brand"> <div class="header__brand">
<a class="header__logo" href="<?php echo network_home_url(); ?>"> <a title="<?php echo get_bloginfo( 'name', 'display' ); ?>" href="<?php echo network_home_url(); ?>">
<?php if ( has_custom_logo() ) { ?> <?php if ( has_custom_logo() ) { ?>
<?php $custom_logo_id = get_theme_mod( 'custom_logo' ); <?php $custom_logo_id = get_theme_mod( 'custom_logo' );
printf( printf(
'<img src="%1$s" srcset="%2$s" alt="%3$s" />', '<img class="header__logo--img" src="%1$s" srcset="%2$s" alt="%3$s" />',
wp_get_attachment_image_src( $custom_logo_id, 'logo' )[0], wp_get_attachment_image_src( $custom_logo_id, 'logo' )[0],
wp_get_attachment_image_srcset( $custom_logo_id, 'large' ), wp_get_attachment_image_srcset( $custom_logo_id, 'large' ),
sprintf( __( 'Logo for %s', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ) sprintf( __( 'Logo for %s', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) )
); ?> ); ?>
<?php } else { ?> <?php } else { ?>
<svg class="logo--svg"> <svg class="header__logo--svg">
<use xlink:href="#logo-pressbooks" /> <use xlink:href="#logo-pressbooks" />
</svg> </svg>
<?php } ?> <?php } ?>
</a> </a>
</div> </div>
<div class="header__nav"> <div class="header__nav">
<a class="header__menu-icon js-header-menu-toggle" href="#navigation"><?php _e( 'Toggle Menu', 'pressbooks-book' ); ?><span class="header__menu-icon__icon"></span></a> <a class="header__nav-icon js-header-nav-toggle" href="#navigation"><?php _e( 'Toggle Menu', 'pressbooks-book' ); ?><span class="header__nav-icon__icon"></span></a>
<?php wp_nav_menu( [ <?php wp_nav_menu( [
'theme_location' => 'primary-menu', 'theme_location' => 'primary-menu',
'container' => 'nav', 'container' => 'nav',
'container_class' => 'js-header-nav', 'container_class' => 'js-header-nav',
'container_id' => 'navigation', 'container_id' => 'navigation',
'menu_class' => 'menu--primary', 'menu_id' => 'nav-primary-menu',
'menu_class' => 'nav--primary',
] ); ?> ] ); ?>
</div> </div>
</div> </div>
<h1><?php echo get_bloginfo( 'name', 'display' ); ?></h1> <h1 class="header__title"><?php echo get_bloginfo( 'name', 'display' ); ?></h1>
<p class="description"><?php echo get_bloginfo( 'description', 'display' ); ?></p> <p class="header__description"><?php echo get_bloginfo( 'description', 'display' ); ?></p>
</header><!-- #masthead --> </header> <!-- .header -->
<div id="content" class="site-content"> <div id="content" class="site-content">

4
inc/actions/namespace.php

@ -145,8 +145,8 @@ function enqueue_assets() {
'aldine/script', 'aldine/script',
'PB_A11y', 'PB_A11y',
[ [
'increase_label' => __( 'Increase Font Size', 'pressbooks-book' ), 'increase_label' => __( 'Increase Font Size', 'pressbooks-aldine' ),
'decrease_label' => __( 'Decrease Font Size', 'pressbooks-book' ), 'decrease_label' => __( 'Decrease Font Size', 'pressbooks-aldine' ),
] ]
); );
} }

12
inc/filters/namespace.php

@ -25,8 +25,8 @@ function body_classes( array $classes ) {
/** Clean up class names for custom templates */ /** Clean up class names for custom templates */
$classes = array_map( function ( $class ) { $classes = array_map( function ( $class ) {
return preg_replace( [ '/-php$/', '/^page-template-/' ], '', $class ); return preg_replace( [ '/-php$/', '/^page-template-views/' ], '', $class );
}, $classes); }, $classes );
return array_filter( $classes ); return array_filter( $classes );
} }
@ -68,13 +68,13 @@ function adjust_menu( $items, $args ) {
$items .= sprintf( $items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>', '<li><a href="%1$s">%2$s</a></li>',
wp_login_url( get_permalink() ), wp_login_url( get_permalink() ),
__( 'Sign in', 'pressbooks-aldine' ) __( 'Sign In', 'pressbooks-aldine' )
); );
if ( in_array( get_site_option( 'registration' ), [ 'user', 'all' ], true ) ) { if ( in_array( get_site_option( 'registration' ), [ 'user', 'all' ], true ) ) {
$items .= sprintf( $items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>', '<li><a href="%1$s">%2$s</a></li>',
network_home_url( '/wp-signup.php' ), network_home_url( '/wp-signup.php' ),
__( 'Sign up', 'pressbooks-aldine' ) __( 'Sign Up', 'pressbooks-aldine' )
); );
} }
} else { } else {
@ -88,11 +88,11 @@ function adjust_menu( $items, $args ) {
$items .= sprintf( $items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>', '<li><a href="%1$s">%2$s</a></li>',
wp_logout_url( get_permalink() ), wp_logout_url( get_permalink() ),
__( 'Sign out', 'pressbooks-aldine' ) __( 'Sign Out', 'pressbooks-aldine' )
); );
} }
/* @codingStandardsIgnoreStart $items .= sprintf( /* @codingStandardsIgnoreStart $items .= sprintf(
'<li class="header__search js-search"><a class="icon icon-search js-toggle-search"></a><div class="header__search__form">%s</div></li>', '<li class="header__search js-search"><div class="header__search__form">%s</div></li>',
get_search_form( false ) get_search_form( false )
); @codingStandardsIgnoreEnd */ ); @codingStandardsIgnoreEnd */
} }

1
package.json

@ -55,7 +55,6 @@
"dependencies": { "dependencies": {
"aetna": "^0.2.0", "aetna": "^0.2.0",
"isotope-layout": "^3.0.4", "isotope-layout": "^3.0.4",
"jquery": "1.12.4 - 3",
"jquery-bridget": "^2.0.1", "jquery-bridget": "^2.0.1",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"wpapi": "^1.1.2" "wpapi": "^1.1.2"

7
searchform.php

@ -0,0 +1,7 @@
<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label for="s">
<?php _ex( 'Search Catalog', 'label', 'pressbooks-aldine' ); ?>
<input id="s" type="search" class="search-field" value="<?php echo get_search_query(); ?>" name="s" />
</label>
<input type="submit" class="search-submit" value="<?php _ex( 'Search', 'submit button', 'pressbooks-aldine' ); ?>" />
</form>

2
yarn.lock

@ -4396,7 +4396,7 @@ jquery-bridget@^2.0.1:
dependencies: dependencies:
jquery ">=1.4.2 <4" jquery ">=1.4.2 <4"
"jquery@1.12.4 - 3", "jquery@>=1.4.2 <4": "jquery@>=1.4.2 <4":
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"

Loading…
Cancel
Save