Browse Source

Fix page layout, part two.

pull/49/head
Ned Zimmerman 7 years ago
parent
commit
24c21b3c0d
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      assets/styles/editor.scss
  2. 13
      assets/styles/layouts/_front-page.scss
  3. 2
      assets/styles/layouts/_header.scss
  4. 24
      assets/styles/layouts/_pages.scss
  5. 4
      dist/mix-manifest.json
  6. 2
      dist/styles/aldine.css
  7. 2
      dist/styles/editor.css
  8. 2
      footer.php
  9. 23
      inc/filters/namespace.php
  10. 4
      inc/helpers/namespace.php
  11. 4
      partials/content-front-page.php
  12. 9
      partials/content-page.php
  13. 2
      webpack.mix.js

2
assets/styles/editor.scss

@ -3,5 +3,5 @@
#tinymce.wp-editor { #tinymce.wp-editor {
@import '~aetna/assets/styles/components/_buttons.scss'; @import '~aetna/assets/styles/components/_buttons.scss';
@import '~aetna/assets/styles/layouts/_blocks.scss'; @import '~aetna/assets/styles/layouts/_page-sections.scss';
} }

13
assets/styles/layouts/_front-page.scss

@ -6,19 +6,8 @@
} }
} }
.home .entry-content:not(.blocks) {
@extend .block;
width: 100%;
max-width: rem(800);
margin: 0 auto;
@media #{$breakpoint-large} {
margin-bottom: 4rem;
}
}
.latest-books { .latest-books {
padding: 0 0 9.625rem; margin: 4rem 0 8rem;
.slider { .slider {
margin: 0 auto; margin: 0 auto;

2
assets/styles/layouts/_header.scss

@ -56,7 +56,7 @@
} }
.page .header { .page .header {
height: 560px; height: 240px;
@media #{$breakpoint-large} { @media #{$breakpoint-large} {
height: 880px; height: 880px;

24
assets/styles/layouts/_pages.scss

@ -1,13 +1,13 @@
.page:not(.home) article { // .page:not(.home) article {
.entry-header h1 { // .entry-header h1 {
@extend .h2; // @extend .h2;
} // }
@extend .block; // @extend .page-section;
text-align: left; // text-align: left;
width: 100%; // width: 100%;
max-width: rem(800); // max-width: rem(800);
margin-top: calc(-80%); // margin-top: calc(-80%);
margin-left: auto; // margin-left: auto;
margin-right: auto; // margin-right: auto;
} // }

4
dist/mix-manifest.json vendored

@ -1,6 +1,6 @@
{ {
"/scripts/aldine.js": "/scripts/aldine.js?id=b3e9fc98283f6851d026", "/scripts/aldine.js": "/scripts/aldine.js?id=b3e9fc98283f6851d026",
"/styles/aldine.css": "/styles/aldine.css?id=029239f1f66d8618b8a3", "/styles/aldine.css": "/styles/aldine.css?id=836ebc69c0086a3a6f03",
"/styles/editor.css": "/styles/editor.css?id=1154985c5551d57d94cc", "/styles/editor.css": "/styles/editor.css?id=10e3f4b144847aa8d75e",
"/scripts/customizer.js": "/scripts/customizer.js?id=b7707466ef7695673a2e" "/scripts/customizer.js": "/scripts/customizer.js?id=b7707466ef7695673a2e"
} }

2
dist/styles/aldine.css vendored

File diff suppressed because one or more lines are too long

2
dist/styles/editor.css vendored

File diff suppressed because one or more lines are too long

2
footer.php

@ -67,7 +67,7 @@ $pb_network_contact_form = get_option( 'pb_network_contact_form' );
</svg> </svg>
</a> </a>
<div class="footer__pressbooks__links"> <div class="footer__pressbooks__links">
<h1 class="footer__pressbooks__links__title"><a href="https://pressbooks.com"><?php printf( __( 'Powered by %s', 'pressbooks-book' ), '<span class="pressbooks">Pressbooks</span>' ); ?></a></h1> <p class="footer__pressbooks__links__title"><a href="https://pressbooks.com"><?php printf( __( 'Powered by %s', 'pressbooks-book' ), '<span class="pressbooks">Pressbooks</span>' ); ?></a></p>
<ul class="footer__pressbooks__links__list"> <ul class="footer__pressbooks__links__list">
<li><a href="https://pressbooks.org"><?php _e( 'Open Source', 'pressbooks-book' ); ?></a> |</li> <li><a href="https://pressbooks.org"><?php _e( 'Open Source', 'pressbooks-book' ); ?></a> |</li>
<li><a href="https://pressbooks.com/for-academia"><?php _e( 'Open Textbooks', 'pressbooks-book' ); ?></a> |</li> <li><a href="https://pressbooks.com/for-academia"><?php _e( 'Open Textbooks', 'pressbooks-book' ); ?></a> |</li>

23
inc/filters/namespace.php

@ -7,6 +7,8 @@
namespace Aldine\Filters; namespace Aldine\Filters;
use function Aldine\Helpers\has_sections;
/** /**
* Adds custom classes to the array of body classes. * Adds custom classes to the array of body classes.
* *
@ -23,6 +25,11 @@ function body_classes( array $classes ) {
} }
} }
/** Add .has-sections if page content has sections */
if ( is_single() || is_page() && has_sections( get_the_ID() ) ) {
$classes[] = 'has-sections';
}
/** 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-views/' ], '', $class ); return preg_replace( [ '/-php$/', '/^page-template-views/' ], '', $class );
@ -61,27 +68,27 @@ function add_style_select( $buttons ) {
function add_blocks( $init_array ) { function add_blocks( $init_array ) {
$style_formats = [ $style_formats = [
[ [
'title' => __( 'Standard Block', 'pressbooks-aldine' ), 'title' => __( 'Page Section', 'pressbooks-aldine' ),
'block' => 'div', 'block' => 'div',
'classes' => [ 'block', 'block--standard' ], 'classes' => [ 'page-section' ],
'wrapper' => true, 'wrapper' => true,
], ],
[ [
'title' => __( 'Alternate Block', 'pressbooks-aldine' ), 'title' => __( 'Page Section (Accent)', 'pressbooks-aldine' ),
'block' => 'div', 'block' => 'div',
'classes' => [ 'block', 'block--alternate' ], 'classes' => [ 'page-section', 'page-section--accent' ],
'wrapper' => true, 'wrapper' => true,
], ],
[ [
'title' => __( 'Bordered Block', 'pressbooks-aldine' ), 'title' => __( 'Page Section (Bordered)', 'pressbooks-aldine' ),
'block' => 'div', 'block' => 'div',
'classes' => [ 'block', 'block--bordered' ], 'classes' => [ 'page-section', 'page-section--bordered' ],
'wrapper' => true, 'wrapper' => true,
], ],
[ [
'title' => __( 'Borderless Block', 'pressbooks-aldine' ), 'title' => __( 'Page Section (Borderless)', 'pressbooks-aldine' ),
'block' => 'div', 'block' => 'div',
'classes' => [ 'block', 'block--borderless' ], 'classes' => [ 'page-section', 'page-section--borderless' ],
'wrapper' => true, 'wrapper' => true,
], ],
[ [

4
inc/helpers/namespace.php

@ -200,10 +200,10 @@ function handle_contact_form_submission() {
return; return;
} }
function has_blocks( $post_id ) { function has_sections( $post_id ) {
$post_content = get_post_field( 'post_content', $post_id ); $post_content = get_post_field( 'post_content', $post_id );
if ( ! empty( $post_content ) ) { if ( ! empty( $post_content ) ) {
if ( strpos( $post_content, 'block--standard' ) || strpos( $post_content, 'block--alternate' ) ) { if ( strpos( $post_content, 'page-section' ) ) {
return true; return true;
} else { } else {
return false; return false;

4
partials/content-front-page.php

@ -11,7 +11,6 @@
<?php <?php
use function Aldine\Helpers\has_blocks;
use function Aldine\Helpers\get_catalog_data; use function Aldine\Helpers\get_catalog_data;
$front_page_catalog = get_option( 'pb_front_page_catalog' ); $front_page_catalog = get_option( 'pb_front_page_catalog' );
@ -29,8 +28,7 @@ $next_page = $page + 1;
<p class="entry-description"><?php echo get_bloginfo( 'description', 'display' ); ?></p> <p class="entry-description"><?php echo get_bloginfo( 'description', 'display' ); ?></p>
</header><!-- .entry-header --> </header><!-- .entry-header -->
<?php $classes = ( has_blocks( get_the_ID() ) ) ? 'entry-content blocks' : 'entry-content'; ?> <div class="entry-content">
<div class="<?php echo $classes; ?>">
<?php <?php
the_content(); the_content();
?> ?>

9
partials/content-page.php

@ -9,19 +9,12 @@
?> ?>
<?php
use function Aldine\Helpers\has_blocks;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"> <header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header --> </header><!-- .entry-header -->
<?php $classes = ( has_blocks( get_the_ID() ) ) ? 'entry-content blocks' : 'entry-content'; ?> <div class="entry-content">
<div class="<?php echo $classes; ?>">
<?php <?php
the_content(); the_content();

2
webpack.mix.js

@ -23,7 +23,7 @@ mix.setResourceRoot('../');
mix.browserSync({ mix.browserSync({
host: 'localhost', host: 'localhost',
proxy: 'https://pressbooks.test', proxy: 'https://pressbooks.test',
port: 3000, port: 3100,
files: [ files: [
'*.php', '*.php',
`${inc}/**/*.php`, `${inc}/**/*.php`,

Loading…
Cancel
Save