From 0809ffe7d39a6b7cf5d4a2280ac2aa2ba29baf14 Mon Sep 17 00:00:00 2001 From: Ricardo Aragon Date: Tue, 23 Aug 2022 10:42:02 -0300 Subject: [PATCH 1/4] feat: apply pb_network_catalog for new catalog support --- page-catalog.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/page-catalog.php b/page-catalog.php index 8ad195b..28d5fa2 100644 --- a/page-catalog.php +++ b/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; From f35dad29896111f895473451c52d6fd7d9159ced Mon Sep 17 00:00:00 2001 From: Ricardo Aragon Date: Tue, 23 Aug 2022 16:20:18 -0300 Subject: [PATCH 2/4] feat: allow custom pages for catalog --- assets/scripts/aldine.js | 2 +- assets/styles/layouts/_header.scss | 2 +- assets/styles/layouts/_page-catalog.scss | 10 +- dist/mix-manifest.json | 6 +- dist/scripts/aldine.js | 2 +- dist/scripts/catalog-admin.js | 2 +- dist/styles/aldine.css | 2 +- inc/actions/namespace.php | 7 +- inc/activation/namespace.php | 9 +- inc/helpers/namespace.php | 13 + package-lock.json | 20706 ++++++++++++++++++++- partials/content-front-page.php | 20 +- 12 files changed, 20727 insertions(+), 54 deletions(-) diff --git a/assets/scripts/aldine.js b/assets/scripts/aldine.js index 1508862..6a73d79 100644 --- a/assets/scripts/aldine.js +++ b/assets/scripts/aldine.js @@ -11,7 +11,7 @@ const routes = new Router( { // Home page home, // Catalog page - catalog, + pageTemplatePageCatalog: catalog, } ); // Load Events diff --git a/assets/styles/layouts/_header.scss b/assets/styles/layouts/_header.scss index 08a9e1c..6bf3d52 100644 --- a/assets/styles/layouts/_header.scss +++ b/assets/styles/layouts/_header.scss @@ -73,7 +73,7 @@ } } -.page.catalog { +.page.page-template-page-catalog { .header { height: rem(381); } diff --git a/assets/styles/layouts/_page-catalog.scss b/assets/styles/layouts/_page-catalog.scss index 5d5948f..fbc0bd7 100644 --- a/assets/styles/layouts/_page-catalog.scss +++ b/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; @@ -240,7 +240,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; @@ -248,7 +248,7 @@ fieldset { } @media #{$breakpoint-large} { - .catalog #content { + .page-template-page-catalog #content { width: calc(100% - 1rem); margin-left: auto; margin-right: auto; @@ -279,13 +279,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; diff --git a/dist/mix-manifest.json b/dist/mix-manifest.json index bc7f337..0d74c6c 100644 --- a/dist/mix-manifest.json +++ b/dist/mix-manifest.json @@ -1,12 +1,12 @@ { - "/scripts/aldine.js": "/scripts/aldine.js?id=f7e0ad5cfcc135b918f6", + "/scripts/aldine.js": "/scripts/aldine.js?id=5ecff462d448444a549b", "/scripts/call-to-action.js": "/scripts/call-to-action.js?id=33370b66c7af12320fc0", - "/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=e8d84fb090536b8e49e9", + "/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=2bc3bfa90831ab142ee9", "/scripts/customizer.js": "/scripts/customizer.js?id=14dca3944228dd789c27", "/scripts/customizer-toggle.js": "/scripts/customizer-toggle.js?id=c31594589675d7c5662a", "/scripts/page-section.js": "/scripts/page-section.js?id=19d5c30146ea1a763bcf", "/styles/editor.css": "/styles/editor.css?id=b7c2449babe566571767", - "/styles/aldine.css": "/styles/aldine.css?id=8d3bfb61118a9ee435a1", + "/styles/aldine.css": "/styles/aldine.css?id=534450cda31e22f1f2a0", "/fonts/pressbooks-theme.woff": "/fonts/pressbooks-theme.woff?id=2a7aae81673f4707bbe7", "/images/banner.jpg": "/images/banner.jpg?id=04a813e0b4f94ddfef19", "/images/catalog-header.jpg": "/images/catalog-header.jpg?id=223b9f7a23985f2a72df", diff --git a/dist/scripts/aldine.js b/dist/scripts/aldine.js index 9fee860..dcb2d0f 100644 --- a/dist/scripts/aldine.js +++ b/dist/scripts/aldine.js @@ -1,2 +1,2 @@ /*! For license information please see aldine.js.LICENSE.txt */ -!function(){var t,e={612:function(t,e,n){"use strict";var i=n(755),r=n(391),o=n(831),s={init:function(){var t;t=document.querySelectorAll("fieldset h2"),Array.prototype.forEach.call(t,(function(t){t.innerHTML='\n\t\t\t\t\n\t\t\t ');var e=function(t){for(var e=[];t.nextElementSibling&&"H2"!==t.nextElementSibling.tagName;)e.push(t.nextElementSibling),t=t.nextElementSibling;return e.forEach((function(t){t.parentNode.removeChild(t)})),e}(t),n=document.createElement("div");n.hidden=!0,e.forEach((function(t){n.appendChild(t)})),t.parentNode.insertBefore(n,t.nextElementSibling);var i=t.querySelector("button");i.onclick=function(){var t="true"===i.getAttribute("aria-expanded")||!1;i.setAttribute("aria-expanded",!t),n.hidden=t}})),function(){var t=document.querySelectorAll("fieldset h3");Array.prototype.forEach.call(t,(function(t){t.innerHTML='\n\t\t\t\t\n\t\t\t ');var e=function(t){for(var e=[];t.nextElementSibling&&"H3"!==t.nextElementSibling.tagName;)e.push(t.nextElementSibling),t=t.nextElementSibling;return e.forEach((function(t){t.parentNode.removeChild(t)})),e}(t),n=document.createElement("div");n.hidden=!0,e.forEach((function(t){n.appendChild(t)})),t.parentNode.insertBefore(n,t.nextElementSibling);var i=t.querySelector("button");i.onclick=function(){var t="true"===i.getAttribute("aria-expanded")||!1;i.setAttribute("aria-expanded",!t),n.hidden=t}}))}(),i((function(t){o("isotope",r,t);var e=t(".books");e.isotope({itemSelector:".book",getSortData:{title:".book__title a",subject:"[data-subject]",latest:"[data-date-published]"},sortAscending:{title:!0,subject:!1,latest:!1}});var n=document.querySelector(".license-filters"),i=document.querySelector(".subject-filters"),s=document.querySelector(".institution-filters"),a=document.querySelector(".sorts"),u=document.querySelector(".clear-filters");u.hidden=!1,n.addEventListener("click",(function(t){if("radio"===t.target.type){var n=i.querySelector('input[type="radio"]:checked').value?'[data-subject="'.concat(i.querySelector('input[type="radio"]:checked').value,'"]'):"",r=s.querySelector('input[type="radio"]:checked').value?'[data-institution*="'.concat(s.querySelector('input[type="radio"]:checked').value,'"]'):"",o=t.target.value?'[data-license="'.concat(t.target.value,'"]'):"",a=n||o||r?"".concat(n).concat(o).concat(r):"*";e.isotope({filter:a})}})),s.addEventListener("click",(function(t){if("radio"===t.target.type){var r=i.querySelector('input[type="radio"]:checked').value?'[data-subject="'.concat(i.querySelector('input[type="radio"]:checked').value,'"]'):"",o=n.querySelector('input[type="radio"]:checked').value?'[data-license="'.concat(n.querySelector('input[type="radio"]:checked').value,'"]'):"",s=t.target.value?'[data-institution*="'.concat(t.target.value,'"]'):"",a=r||o||s?"".concat(r).concat(o).concat(s):"*";e.isotope({filter:a})}})),i.addEventListener("click",(function(t){if("radio"===t.target.type){var i=n.querySelector('input[type="radio"]:checked').value?'[data-license="'.concat(n.querySelector('input[type="radio"]:checked').value,'"]'):"",r=s.querySelector('input[type="radio"]:checked').value?'[data-institution*="'.concat(s.querySelector('input[type="radio"]:checked').value,'"]'):"",o=t.target.value?'[data-subject="'.concat(t.target.value,'"]'):"",a=o||i||r?"".concat(o).concat(i).concat(r):"*";e.isotope({filter:a})}})),u.addEventListener("click",(function(){var t=document.getElementById("all-licenses"),n=document.getElementById("all-subjects"),i=document.getElementById("all-institutions");t.checked=!0,n.checked=!0,i.checked=!0,e.isotope({filter:"*"})})),a.addEventListener("click",(function(t){"radio"===t.target.type&&e.isotope({sortBy:t.target.value})}))}))},finalize:function(){}},a=n(755),u={init:function(){document.body.classList.remove("no-js"),document.body.classList.add("js"),a((function(t){t(document).ready((function(){for(var e=document.getElementsByTagName("section"),n=0,i=e.length;n1&&void 0!==arguments[1]?arguments[1]:"init",n=arguments.length>2?arguments[2]:void 0,i=""!==t&&this.routes[t]&&"function"==typeof this.routes[t][e];i&&this.routes[t][e](n)}},{key:"loadEvents",value:function(){var t=this;this.fire("common"),document.body.className.toLowerCase().replace(/-/g,"_").split(/\s+/).map(l).forEach((function(e){t.fire(e),t.fire(e,"finalize")})),this.fire("common","finalize")}}])&&c(e.prototype,n),i&&c(e,i),t}(),d=n(755),h=new f({common:u,home:{init:function(){},finalize:function(){}},catalog:s});d(document).ready((function(){return h.loadEvents()}))},741:function(t,e,n){var i,r;!function(o,s){"use strict";void 0===(r="function"==typeof(i=s)?i.call(e,n,e,t):i)||(t.exports=r)}(window,(function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],n=0;n