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 Router from './util/Router';
import common from './routes/common';

204
assets/scripts/routes/catalog.js

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

109
assets/scripts/routes/common.js

@ -3,66 +3,73 @@ import * as Cookies from 'js-cookie';
export default {
init() {
// JavaScript to be fired on all pages
$( 'body' )
.removeClass( 'no-js' )
.addClass( 'js' );
$( document ).ready( function () {
// Fontsize handler
if ( Cookies.get( 'a11y-larger-fontsize' ) === '1' ) {
$( 'html' ).addClass( 'fontsize' );
$( '#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' ) {
jQuery( $ => {
$( 'body' )
.removeClass( 'no-js' )
.addClass( 'js' );
$( document ).ready( function () {
// Fontsize handler
if ( Cookies.get( 'a11y-larger-fontsize' ) === '1' ) {
$( 'html' ).addClass( 'fontsize' );
$( this )
$( '#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 );
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
let sections = document.getElementsByTagName( 'section' );
for ( let i = 0, max = sections.length; i < max; i++ ) {
sections[i].setAttribute( 'tabindex', -1 );
sections[i].className += ' focusable';
}
$( '.toggle-fontsize' ).on( 'click', function () {
if ( $( this ).attr( 'id' ) === 'is_normal_fontsize' ) {
$( 'html' ).addClass( 'fontsize' );
$( this )
.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
// Thanks to WebAIM.org for this idea
if ( document.location.hash && document.location.hash !== '#' ) {
let anchorUponArrival = document.location.hash;
setTimeout( function () {
$( anchorUponArrival ).scrollTo( { duration: 1500 } );
$( anchorUponArrival ).focus();
}, 100 );
}
} );
$( '.js-header-menu-toggle' ).click( event => {
event.preventDefault();
$( event.currentTarget ).toggleClass( '--active' );
$( '.js-header-nav' ).toggleClass( '--visible' );
// Sets a -1 tabindex to ALL sections for .focus()-ing
let sections = document.getElementsByTagName( 'section' );
for ( let i = 0, max = sections.length; i < max; i++ ) {
sections[i].setAttribute( 'tabindex', -1 );
sections[i].className += ' focusable';
}
// 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 !== '#' ) {
let anchorUponArrival = document.location.hash;
setTimeout( function () {
$( anchorUponArrival ).scrollTo( { duration: 1500 } );
$( anchorUponArrival ).focus();
}, 100 );
}
} );
$( '.js-header-nav-toggle' ).click( event => {
event.preventDefault();
$( '.header__nav' ).toggleClass( 'header__nav--active' );
} );
} );
},
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
*/
class Router {
/**
* Create a new Router
* @param {Object} routes
*/
constructor( routes ) {
this.routes = routes;
}
/**
* Create a new Router
* @param {Object} routes
*/
constructor(routes) {
this.routes = routes;
}
/**
* 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.
* @param {string} [arg] Any custom argument to be passed to the event.
*/
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
* @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.
* @param {string} [arg] Any custom argument to be passed to the event.
*/
fire(route, event = 'init', arg) {
const fire = route !== '' && this.routes[route] && typeof this.routes[route][event] === 'function';
if (fire) {
this.routes[route][event](arg);
}
}
/**
* Automatically load and fire Router events
*
* Events are fired in the following order:
* * common init
* * page-specific init
* * page-specific finalize
* * common finalize
*/
loadEvents() {
// Fire common init JS
this.fire( 'common' );
/**
* Automatically load and fire Router events
*
* Events are fired in the following order:
* * common init
* * page-specific init
* * page-specific finalize
* * common finalize
*/
loadEvents() {
// Fire common init JS
this.fire('common');
// Fire page-specific init JS, and then finalize JS
document.body.className
.toLowerCase()
.replace( /-/g, '_' )
.split( /\s+/ )
.map( camelCase )
.forEach( className => {
this.fire( className );
this.fire( className, 'finalize' );
} );
// Fire page-specific init JS, and then finalize JS
document.body.className
.toLowerCase()
.replace(/-/g, '_')
.split(/\s+/)
.map(camelCase)
.forEach((className) => {
this.fire(className);
this.fire(className, 'finalize');
});
// Fire common finalize JS
this.fire('common', '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
* @return {string} String converted to camel-case, e.g., camelCaseIsHard
*/
export default str => `${str.charAt(0).toLowerCase()}${str.replace(/[\W_]/g, '|').split('|')
.map(part => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
.join('')
.slice(1)}`;
export default str =>
`${str.charAt( 0 ).toLowerCase()}${str
.replace( /[\W_]/g, '|' )
.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/grid";
// @import "components/wp-classes";
// @import "layouts/header";
@import "layouts/header";
// @import "layouts/sidebar";
// @import "layouts/footer";
// @import "layouts/pages";

220
assets/styles/layouts/_header.scss

@ -1,214 +1,42 @@
.banner {
.home .header {
background-position: bottom;
background-size: cover;
height: 560px;
.container {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
height: 560px;
width: 100%;
&__title {
font-family: $font-family-sans-serif;
font-size: 1.875rem;
margin-top: 3rem;
margin-bottom: 0;
text-align: center;
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 {
display: block;
align-self: flex-start;
width: 6.5625rem;
height: auto;
margin: 30px 0 0 17px;
svg,
img {
width: auto;
max-width: 100%;
height: auto;
}
&__description {
font-family: $font-family-sans-serif;
font-size: 1.125rem;
margin-bottom: 0;
text-align: center;
max-width: 100%;
}
&__navigation {
display: flex;
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);
@media #{$breakpoint-large} {
height: 880px;
&:last-child {
border-bottom: 0;
}
}
&__title {
font-size: 4.5rem;
}
}
&__branding {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 364px;
text-align: center;
p {
font-family: $font-family-sans-serif;
&__description {
font-size: 1.875rem;
}
}
}
.page:not(.home) .banner__branding {
display: none;
.page .header {
// TODO
}
@media #{$breakpoint-large} {
.banner {
.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);
}
}
.page.catalog .header {
// TODO
}

4
dist/mix-manifest.json vendored

@ -1,5 +1,5 @@
{
"/scripts/aldine.js": "/scripts/aldine.js?id=f0380c51980a33b2d33c",
"/styles/aldine.css": "/styles/aldine.css?id=405ee7591545ea8b1977",
"/scripts/aldine.js": "/scripts/aldine.js?id=af09fa97e83d238ec459",
"/styles/aldine.css": "/styles/aldine.css?id=28b42418cb02cfbe2c49",
"/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>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'pressbooks-aldine' ); ?></a>
<header id="masthead" class="header header--root" role="banner" style="background-image: url(<?php
<header class="header" role="banner" style="background-image: url(<?php
if ( is_front_page() ) {
echo( get_header_image() );
} else {
echo get_template_directory_uri() . '/dist/images/catalog-header.jpg';
} ?>);">
<div class="header__inner">
<div class="header__inside">
<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 $custom_logo_id = get_theme_mod( 'custom_logo' );
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_srcset( $custom_logo_id, 'large' ),
sprintf( __( 'Logo for %s', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) )
); ?>
<?php } else { ?>
<svg class="logo--svg">
<svg class="header__logo--svg">
<use xlink:href="#logo-pressbooks" />
</svg>
<?php } ?>
</a>
</div>
<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( [
'theme_location' => 'primary-menu',
'container' => 'nav',
'container_class' => 'js-header-nav',
'container_id' => 'navigation',
'menu_class' => 'menu--primary',
'menu_id' => 'nav-primary-menu',
'menu_class' => 'nav--primary',
] ); ?>
</div>
</div>
<h1><?php echo get_bloginfo( 'name', 'display' ); ?></h1>
<p class="description"><?php echo get_bloginfo( 'description', 'display' ); ?></p>
</header><!-- #masthead -->
<h1 class="header__title"><?php echo get_bloginfo( 'name', 'display' ); ?></h1>
<p class="header__description"><?php echo get_bloginfo( 'description', 'display' ); ?></p>
</header> <!-- .header -->
<div id="content" class="site-content">

4
inc/actions/namespace.php

@ -145,8 +145,8 @@ function enqueue_assets() {
'aldine/script',
'PB_A11y',
[
'increase_label' => __( 'Increase Font Size', 'pressbooks-book' ),
'decrease_label' => __( 'Decrease Font Size', 'pressbooks-book' ),
'increase_label' => __( 'Increase Font Size', 'pressbooks-aldine' ),
'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 */
$classes = array_map( function ( $class ) {
return preg_replace( [ '/-php$/', '/^page-template-/' ], '', $class );
}, $classes);
return preg_replace( [ '/-php$/', '/^page-template-views/' ], '', $class );
}, $classes );
return array_filter( $classes );
}
@ -68,13 +68,13 @@ function adjust_menu( $items, $args ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
wp_login_url( get_permalink() ),
__( 'Sign in', 'pressbooks-aldine' )
__( 'Sign In', 'pressbooks-aldine' )
);
if ( in_array( get_site_option( 'registration' ), [ 'user', 'all' ], true ) ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
network_home_url( '/wp-signup.php' ),
__( 'Sign up', 'pressbooks-aldine' )
__( 'Sign Up', 'pressbooks-aldine' )
);
}
} else {
@ -88,11 +88,11 @@ function adjust_menu( $items, $args ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
wp_logout_url( get_permalink() ),
__( 'Sign out', 'pressbooks-aldine' )
__( 'Sign Out', 'pressbooks-aldine' )
);
}
/* @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 )
); @codingStandardsIgnoreEnd */
}

1
package.json

@ -55,7 +55,6 @@
"dependencies": {
"aetna": "^0.2.0",
"isotope-layout": "^3.0.4",
"jquery": "1.12.4 - 3",
"jquery-bridget": "^2.0.1",
"js-cookie": "^2.2.0",
"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:
jquery ">=1.4.2 <4"
"jquery@1.12.4 - 3", "jquery@>=1.4.2 <4":
"jquery@>=1.4.2 <4":
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"

Loading…
Cancel
Save