Browse Source

Merge pull request #351 from pressbooks/pbald-345-catalogSupport

feat: add new Catalog support
pull/352/head
Oscar Arzola 2 years ago committed by GitHub
parent
commit
ca23d415b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      assets/scripts/aldine.js
  2. 2
      assets/styles/layouts/_header.scss
  3. 10
      assets/styles/layouts/_page-catalog.scss
  4. 34
      dist/mix-manifest.json
  5. 397
      dist/scripts/aldine.js
  6. 33
      dist/scripts/call-to-action.js
  7. 68
      dist/scripts/catalog-admin.js
  8. 33
      dist/scripts/customizer-toggle.js
  9. 33
      dist/scripts/customizer.js
  10. 33
      dist/scripts/page-section.js
  11. 2696
      dist/styles/aldine.css
  12. 387
      dist/styles/editor.css
  13. 4
      inc/actions/namespace.php
  14. 9
      inc/activation/namespace.php
  15. 13
      inc/helpers/namespace.php
  16. 14806
      package-lock.json
  17. 5
      page-catalog.php
  18. 20
      partials/content-front-page.php

2
assets/scripts/aldine.js

@ -11,7 +11,7 @@ const routes = new Router( {
// Home page
home,
// Catalog page
catalog,
pageTemplatePageCatalog: catalog,
} );
// Load Events

2
assets/styles/layouts/_header.scss

@ -76,7 +76,7 @@
}
}
.page.catalog {
.page.page-template-page-catalog {
.header {
height: rem(381);
}

10
assets/styles/layouts/_page-catalog.scss

@ -121,7 +121,7 @@ fieldset {
margin: 0 1rem;
}
.catalog {
.page-template-page-catalog {
.books {
width: calc(100% - 1rem);
padding: 0;
@ -241,7 +241,7 @@ fieldset {
margin-left: 0;
}
.catalog .book {
.page-template-page-catalog .book {
height: 16.25rem;
width: calc(100% / 3 - 1rem);
margin: 0 1rem 1rem 0;
@ -249,7 +249,7 @@ fieldset {
}
@media #{$breakpoint-large} {
.catalog #content {
.page-template-page-catalog #content {
width: calc(100% - 1rem);
margin-left: auto;
margin-right: auto;
@ -280,13 +280,13 @@ fieldset {
margin-left: 0;
}
.catalog .books {
.page-template-page-catalog .books {
width: 75%;
float: right;
margin-left: 0;
}
.catalog .book {
.page-template-page-catalog .book {
height: 16.25rem;
max-width: calc(100% / 3 - 1rem);
margin: 0 1rem 1rem 0;

34
dist/mix-manifest.json vendored

@ -1,19 +1,19 @@
{
"/scripts/aldine.js": "/scripts/aldine.js?id=9a92306ccdc10e63f9f74ea17764c5f6",
"/scripts/call-to-action.js": "/scripts/call-to-action.js?id=33370b66c7af12320fc0e1250f6be399",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=2bc3bfa90831ab142ee9ebeb14ddab3c",
"/scripts/customizer.js": "/scripts/customizer.js?id=14dca3944228dd789c27c772d55bf471",
"/scripts/customizer-toggle.js": "/scripts/customizer-toggle.js?id=c31594589675d7c5662aaddcf7a9669a",
"/scripts/page-section.js": "/scripts/page-section.js?id=19d5c30146ea1a763bcf2bd733a75e77",
"/styles/editor.css": "/styles/editor.css?id=3fd7086e0f2bcacabc5152bf57ca90ca",
"/styles/aldine.css": "/styles/aldine.css?id=45e9d79c2620145986f1572789ea60fa",
"/fonts/pressbooks-theme.woff": "/fonts/pressbooks-theme.woff?id=2a7aae81673f4707bbe78c8f12b72b64",
"/images/banner.jpg": "/images/banner.jpg?id=04a813e0b4f94ddfef1951557166e417",
"/images/catalog-header.jpg": "/images/catalog-header.jpg?id=223b9f7a23985f2a72df72e4e4a2ffdc",
"/images/header.jpg": "/images/header.jpg?id=c6712212b6aa749cf1cf1f077c679f9f",
"/images/left-arrow.svg": "/images/left-arrow.svg?id=91d479e2d001857a3ee46691c0187854",
"/images/logo.svg": "/images/logo.svg?id=d71cb98d33ef823ffd27b15ae07e723a",
"/images/pb.svg": "/images/pb.svg?id=c08fb158c15a470648a74591e1fc94a4",
"/images/right-arrow.svg": "/images/right-arrow.svg?id=ee2d7230318ea54ae20bd9d5fd96efd6",
"/images/yt_icon_mono_dark.png": "/images/yt_icon_mono_dark.png?id=ee68b73409979a92944025ae95a18011"
"/scripts/aldine.js": "/scripts/aldine.js",
"/scripts/call-to-action.js": "/scripts/call-to-action.js",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js",
"/scripts/customizer.js": "/scripts/customizer.js",
"/scripts/customizer-toggle.js": "/scripts/customizer-toggle.js",
"/scripts/page-section.js": "/scripts/page-section.js",
"/styles/editor.css": "/styles/editor.css",
"/styles/aldine.css": "/styles/aldine.css",
"/fonts/pressbooks-theme.woff": "/fonts/pressbooks-theme.woff",
"/images/banner.jpg": "/images/banner.jpg",
"/images/catalog-header.jpg": "/images/catalog-header.jpg",
"/images/header.jpg": "/images/header.jpg",
"/images/left-arrow.svg": "/images/left-arrow.svg",
"/images/logo.svg": "/images/logo.svg",
"/images/pb.svg": "/images/pb.svg",
"/images/right-arrow.svg": "/images/right-arrow.svg",
"/images/yt_icon_mono_dark.png": "/images/yt_icon_mono_dark.png"
}

397
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

33
dist/scripts/call-to-action.js vendored

File diff suppressed because one or more lines are too long

68
dist/scripts/catalog-admin.js vendored

File diff suppressed because one or more lines are too long

33
dist/scripts/customizer-toggle.js vendored

@ -1 +1,32 @@
document.addEventListener("DOMContentLoaded",(function(){var t=document.getElementById("_customize-input-pb_network_contact_form"),e=document.getElementById("customize-control-pb_network_contact_email"),s=document.getElementById("customize-control-pb_network_contact_link"),n=document.getElementById("customize-control-pb_network_contact_form_title");function c(){!1===t.checked?(e.classList.add("hidden"),e.style.cssText=null,n.classList.add("hidden"),n.style.cssText=null,s.classList.remove("hidden"),s.style.cssText="display: list-item;"):(e.classList.remove("hidden"),e.style.cssText="display: list-item;",n.classList.remove("hidden"),n.style.cssText="display: list-item;",s.classList.add("hidden"),s.style.cssText=null)}t.addEventListener("click",c),c()}));
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./assets/scripts/customizer-toggle.js":
/*!*********************************************!*\
!*** ./assets/scripts/customizer-toggle.js ***!
\*********************************************/
/***/ (function() {
eval("document.addEventListener('DOMContentLoaded', function () {\n var checkbox = document.getElementById('_customize-input-pb_network_contact_form');\n var email = document.getElementById('customize-control-pb_network_contact_email');\n var link = document.getElementById('customize-control-pb_network_contact_link');\n var title = document.getElementById('customize-control-pb_network_contact_form_title');\n checkbox.addEventListener('click', toggleReadOnly);\n /**\n *\n */\n\n function toggleReadOnly() {\n if (checkbox.checked === false) {\n email.classList.add('hidden');\n email.style.cssText = null;\n title.classList.add('hidden');\n title.style.cssText = null;\n link.classList.remove('hidden');\n link.style.cssText = 'display: list-item;';\n } else {\n email.classList.remove('hidden');\n email.style.cssText = 'display: list-item;';\n title.classList.remove('hidden');\n title.style.cssText = 'display: list-item;';\n link.classList.add('hidden');\n link.style.cssText = null;\n }\n }\n\n toggleReadOnly();\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9AcHJlc3Nib29rcy9wcmVzc2Jvb2tzLWFsZGluZS8uL2Fzc2V0cy9zY3JpcHRzL2N1c3RvbWl6ZXItdG9nZ2xlLmpzP2U0Y2IiXSwibmFtZXMiOlsiZG9jdW1lbnQiLCJhZGRFdmVudExpc3RlbmVyIiwiY2hlY2tib3giLCJnZXRFbGVtZW50QnlJZCIsImVtYWlsIiwibGluayIsInRpdGxlIiwidG9nZ2xlUmVhZE9ubHkiLCJjaGVja2VkIiwiY2xhc3NMaXN0IiwiYWRkIiwic3R5bGUiLCJjc3NUZXh0IiwicmVtb3ZlIl0sIm1hcHBpbmdzIjoiQUFBQUEsUUFBUSxDQUFDQyxnQkFBVCxDQUEyQixrQkFBM0IsRUFBK0MsWUFBWTtBQUMxRCxNQUFJQyxRQUFRLEdBQUdGLFF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c2UgKSB7XG5cdFx0XHRlbWFpbC5jbGFzc0xpc3QuYWRkKCAnaGlkZGVuJyApO1xuXHRcdFx0ZW1haWwuc3R5bGUuY3NzVGV4dCA9IG51bGw7XG5cblx0XHRcdHRpdGxlLmNsYXNzTGlzdC5hZGQoICdoaWRkZW4nICk7XG5cdFx0XHR0aXRsZS5zdHlsZS5jc3NUZXh0ID0gbnVsbDtcblxuXHRcdFx0bGluay5jbGFzc0xpc3QucmVtb3ZlKCAnaGlkZGVuJyApO1xuXHRcdFx0bGluay5zdHlsZS5jc3NUZXh0ID0gJ2Rpc3BsYXk6IGxpc3QtaXRlbTsnO1xuXHRcdH0gZWxzZSB7XG5cdFx0XHRlbWFpbC5jbGFzc0xpc3QucmVtb3ZlKCAnaGlkZGVuJyApO1xuXHRcdFx0ZW1haWwuc3R5bGUuY3NzVGV4dCA9ICdkaXNwbGF5OiBsaXN0LWl0ZW07JztcblxuXHRcdFx0dGl0bGUuY2xhc3NMaXN0LnJlbW92ZSggJ2hpZGRlbicgKTtcblx0XHRcdHRpdGxlLnN0eWxlLmNzc1RleHQgPSAnZGlzcGxheTogbGlzdC1pdGVtOyc7XG5cblx0XHRcdGxpbmsuY2xhc3NMaXN0LmFkZCggJ2hpZGRlbicgKTtcblx0XHRcdGxpbmsuc3R5bGUuY3NzVGV4dCA9IG51bGw7XG5cdFx0fVxuXHR9XG5cblx0dG9nZ2xlUmVhZE9ubHkoKTtcblxufSApO1xuIl0sImZpbGUiOiIuL2Fzc2V0cy9zY3JpcHRzL2N1c3RvbWl6ZXItdG9nZ2xlLmpzLmpzIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./assets/scripts/customizer-toggle.js\n");
/***/ })
/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./assets/scripts/customizer-toggle.js"]();
/******/
/******/ })()
;

33
dist/scripts/customizer.js vendored

@ -1 +1,32 @@
wp.customize("blogname",(function(t){t.bind((function(t){return document.querySelector(".home .entry-title").textContent=t}))})),wp.customize("blogdescription",(function(t){t.bind((function(t){return document.querySelector(".home .entry-description").textContent=t}))}));
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./assets/scripts/customizer.js":
/*!**************************************!*\
!*** ./assets/scripts/customizer.js ***!
\**************************************/
/***/ (function() {
eval("wp.customize('blogname', function (value) {\n value.bind(function (to) {\n return document.querySelector('.home .entry-title').textContent = to;\n });\n});\nwp.customize('blogdescription', function (value) {\n value.bind(function (to) {\n return document.querySelector('.home .entry-description').textContent = to;\n });\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9AcHJlc3Nib29rcy9wcmVzc2Jvb2tzLWFsZGluZS8uL2Fzc2V0cy9zY3JpcHRzL2N1c3RvbWl6ZXIuanM/ZWIyMCJdLCJuYW1lcyI6WyJ3cCIsImN1c3RvbWl6ZSIsInZhbHVlIiwiYmluZCIsInRvIiwiZG9jdW1lbnQiLCJxdWVyeVNlbGVjdG9yIiwidGV4dENvbnRlbnQiXSwibWFwcGluZ3MiOiJBQUFBQSxFQUFFLENBQUNDLFNBQUgsQ0FBYyxVQUFkLEVBQTBCLFVBQUFDLEtBQUssRUFBSTtBQUNsQ0EsRUFBQUEsS0FBSyxDQUFDQyxJQUFOLENBQVksVUFBQUMsRUFBRTtBQUFBLFdBQUlDLFFBQVEsQ0FBQ0MsYUFBVCxDQUF3QixvQkFBeEIsRUFBK0NDLFdBQS9DLEdBQTZESCxFQUFqRTtBQUFBLEdBQWQ7QUFDQSxDQUZEO0FBSUFKLEVBQUUsQ0FBQ0MsU0FBSCxDQUFjLGlCQUFkLEVBQWlDLFVBQUFDLEtBQUssRUFBSTtBQUN6Q0EsRUFBQUEsS0FBSyxDQUFDQyxJQUFOLENBQVksVUFBQUMsRUFBRTtBQUFBLFdBQUlDLFFBQVEsQ0FBQ0MsYUFBVCxDQUF3QiwwQkFBeEIsRUFBcURDLFdBQXJELEdBQW1FSCxFQUF2RTtBQUFBLEdBQWQ7QUFDQSxDQUZEIiwic291cmNlc0NvbnRlbnQiOlsid3AuY3VzdG9taXplKCAnYmxvZ25hbWUnLCB2YWx1ZSA9PiB7XG5cdHZhbHVlLmJpbmQoIHRvID0+IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoICcuaG9tZSAuZW50cnktdGl0bGUnICkudGV4dENvbnRlbnQgPSB0byApO1xufSApO1xuXG53cC5jdXN0b21pemUoICdibG9nZGVzY3JpcHRpb24nLCB2YWx1ZSA9PiB7XG5cdHZhbHVlLmJpbmQoIHRvID0+IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoICcuaG9tZSAuZW50cnktZGVzY3JpcHRpb24nICkudGV4dENvbnRlbnQgPSB0byApO1xufSApO1xuIl0sImZpbGUiOiIuL2Fzc2V0cy9zY3JpcHRzL2N1c3RvbWl6ZXIuanMuanMiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./assets/scripts/customizer.js\n");
/***/ })
/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./assets/scripts/customizer.js"]();
/******/
/******/ })()
;

33
dist/scripts/page-section.js vendored

File diff suppressed because one or more lines are too long

2696
dist/styles/aldine.css vendored

File diff suppressed because one or more lines are too long

387
dist/styles/editor.css vendored

File diff suppressed because one or more lines are too long

4
inc/actions/namespace.php

@ -230,8 +230,8 @@ function hide_catalog_content_editor() {
if ( ! isset( $post_id ) ) {
return;
}
$pagename = get_the_title( $post_id );
if ( $pagename === 'Catalog' ) {
$template = get_page_template_slug( $post_id );
if ( $template === 'page-catalog.php' ) {
add_action(
'edit_form_after_title', function() {
printf( '<p>%s</p>', __( 'This page displays your network catalog, so there is no content to edit.', 'pressbooks-aldine' ) );

9
inc/activation/namespace.php

@ -7,6 +7,8 @@
namespace Aldine\Activation;
use function Aldine\Helpers\get_catalog_page;
/**
* Create default page content, importing from Pressbooks Publisher, if possible.
*/
@ -87,6 +89,9 @@ function create_default_content() {
'catalog' => [
'post_title' => __( 'Catalog', 'pressbooks-aldine' ),
'post_content' => '',
'meta_input' => [
'_wp_page_template' => 'page-catalog.php',
],
],
'home' => [
'post_title' => __( 'Home', 'pressbooks-aldine' ),
@ -141,7 +146,7 @@ function create_menus() {
if ( ! wp_get_nav_menu_object( $menu_name ) ) {
$menu_id = wp_create_nav_menu( $menu_name );
$catalog = get_page_by_title( __( 'Catalog', 'pressbooks-aldine' ) );
$catalog = get_catalog_page();
if ( $catalog && defined( 'PB_PLUGIN_VERSION' ) ) {
wp_update_nav_menu_item(
$menu_id,
@ -177,7 +182,7 @@ function create_menus() {
);
}
$catalog = get_page_by_title( __( 'Catalog', 'pressbooks-aldine' ) );
$catalog = get_catalog_page();
if ( $catalog && defined( 'PB_PLUGIN_VERSION' ) ) {
wp_update_nav_menu_item(
$menu_id,

13
inc/helpers/namespace.php

@ -437,3 +437,16 @@ function maybe_truncate_string( $string, $length = 40 ) {
}
return $string;
}
/**
* Get catalog page.
*
* @return WP_Post|null
*/
function get_catalog_page(): ?\WP_Post {
$catalog_pages = get_pages( [
'meta_key' => '_wp_page_template',
'meta_value' => 'page-catalog.php', //phpcs:ignore HM.Performance.SlowMetaQuery.slow_query_meta_value
]);
return $catalog_pages[0] ?? null;
}

14806
package-lock.json generated

File diff suppressed because it is too large Load Diff

5
page-catalog.php

@ -9,6 +9,11 @@
* @package Aldine
*/
if ( has_filter( 'pb_network_catalog' ) ) {
echo apply_filters( 'pb_network_catalog', '' );
return;
}
use function Aldine\Helpers\get_available_institutions;
use function Aldine\Helpers\get_available_licenses;
use function Aldine\Helpers\get_available_subjects;

20
partials/content-front-page.php

@ -7,14 +7,9 @@
* @package Aldine
*/
?>
<?php
use function Aldine\Helpers\get_catalog_data;
use function Aldine\Helpers\has_sections;
$front_page_catalog = get_option( 'pb_front_page_catalog' );
$pb_front_page_catalog_title = get_option( 'pb_front_page_catalog_title' );
$latest_books_title = ( ! empty( $pb_front_page_catalog_title ) ) ? $pb_front_page_catalog_title : __( 'Our Latest Titles', 'pressbooks-aldine' );
if ( get_option( 'pb_front_page_catalog' ) ) {
@ -24,6 +19,11 @@ if ( get_option( 'pb_front_page_catalog' ) ) {
$next_page = $page + 1;
}
$catalog_page = \Aldine\Helpers\get_catalog_page();
if ( $catalog_page ) {
$catalog_permalink = get_permalink( $catalog_page->ID );
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@ -55,10 +55,10 @@ if ( get_option( 'pb_front_page_catalog' ) ) {
<?php if ( get_option( 'pb_front_page_catalog' ) && ! empty( $catalog_data['books'] ) ) : ?>
<div id="latest-books" class="latest-books">
<h2 id="latest-books-title"><?php echo $latest_books_title; ?></h2>
<div class="slider" role="region" aria-labelledby="latest-books-title" data-total-pages="<?php echo $catalog_data['pages']; ?>"
<?php
if ( $next_page <= $catalog_data['pages'] ) :
?>
<div class="slider" role="region" aria-labelledby="latest-books-title" data-total-pages="<?php echo $catalog_data['pages']; ?>"
<?php
if ( $next_page <= $catalog_data['pages'] ) :
?>
data-next-page="<?php echo $next_page; ?>"<?php endif; ?>>
<ul class="books">
<?php
@ -73,7 +73,7 @@ if ( get_option( 'pb_front_page_catalog' ) ) {
?>
</div>
<p class="catalog-link">
<a class="call-to-action" href="<?php echo network_home_url( '/catalog/' ); ?>"><?php _e( 'View Complete Catalog', 'pressbooks-aldine' ); ?></a>
<a class="call-to-action" href="<?php echo $catalog_permalink ?? ''; ?>"><?php _e( 'View Complete Catalog', 'pressbooks-aldine' ); ?></a>
</p>
</div>
<?php endif; ?>

Loading…
Cancel
Save