Browse Source

Merge branch 'dev' of https://github.com/pressbooks/pressbooks-aldine into dev

pull/107/head 1.0.1
Ned Zimmerman 7 years ago
parent
commit
0b6ab94eb3
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 10
      assets/scripts/routes/common.js
  2. 17
      assets/styles/layouts/_header.scss
  3. 20
      assets/styles/layouts/_page.scss
  4. 4
      dist/mix-manifest.json
  5. 2
      dist/scripts/aldine.js
  6. 2
      dist/styles/aldine.css
  7. 4
      header.php
  8. 2
      inc/actions/namespace.php
  9. 7
      inc/activation/namespace.php
  10. 2
      inc/filters/namespace.php
  11. 6
      inc/shortcodes/namespace.php
  12. 11
      partials/content-front-page.php

10
assets/scripts/routes/common.js

@ -9,7 +9,7 @@ export default {
.addClass( 'js' ); .addClass( 'js' );
$( document ).ready( function () { $( document ).ready( function () {
// Fontsize handler // Fontsize handler
if ( Cookies.get( 'a11y-larger-fontsize' ) === '1' ) { if ( Cookies.get( 'a11y-root-larger-fontsize' ) === '1' ) {
$( 'html' ).addClass( 'fontsize' ); $( 'html' ).addClass( 'fontsize' );
$( '#is_normal_fontsize' ) $( '#is_normal_fontsize' )
.attr( 'id', 'is_large_fontsize' ) .attr( 'id', 'is_large_fontsize' )
@ -28,9 +28,9 @@ export default {
.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', { Cookies.set( 'a11y-root-larger-fontsize', '1', {
expires: 365, expires: 365,
path: '', path: '/',
} ); } );
return false; return false;
} else { } else {
@ -41,9 +41,9 @@ export default {
.removeClass( 'active' ) .removeClass( 'active' )
.text( PB_A11y.increase_label ) .text( PB_A11y.increase_label )
.attr( 'title', PB_A11y.increase_label ); .attr( 'title', PB_A11y.increase_label );
Cookies.set( 'a11y-larger-fontsize', '0', { Cookies.set( 'a11y-root-larger-fontsize', '0', {
expires: 365, expires: 365,
path: '', path: '/',
} ); } );
return false; return false;
} }

17
assets/styles/layouts/_header.scss

@ -61,16 +61,16 @@
} }
.page:not(.home) .header { .page:not(.home) .header {
height: 240px; height: rem(240);
@media #{$breakpoint-large} { @media #{$breakpoint-large} {
height: 880px; height: rem(880);
} }
} }
.page.catalog { .page.catalog {
.header { .header {
height: 381px; height: rem(381);
} }
.page-header { .page-header {
@ -83,12 +83,17 @@
@media #{$breakpoint-large} { @media #{$breakpoint-large} {
.header { .header {
height: 450px; height: rem(450);
} }
.page-header { .page-header {
height: 381px; height: rem(381);
margin-top: -381px; margin-top: rem(-381);
.font-size & {
height: rem(350);
margin-top: rem(-350);
}
} }
} }
} }

20
assets/styles/layouts/_page.scss

@ -1 +1,19 @@
// TODO body {
display: flex;
min-height: 100vh;
flex-direction: column;
#page {
flex: 1;
display: flex;
flex-direction: column;
}
#content {
flex-grow: 1;
}
}
.page.home:not(.has-sections) article {
margin-top: 0;
}

4
dist/mix-manifest.json vendored

@ -1,6 +1,6 @@
{ {
"/scripts/aldine.js": "/scripts/aldine.js?id=1f58027f7de9942caf57", "/scripts/aldine.js": "/scripts/aldine.js?id=e222d7e1e1c71c6bdb98",
"/styles/aldine.css": "/styles/aldine.css?id=bd38b94fc99f5bf65198", "/styles/aldine.css": "/styles/aldine.css?id=2648daa49889948f53c9",
"/styles/editor.css": "/styles/editor.css?id=e96b3d10ea63fa07d09b", "/styles/editor.css": "/styles/editor.css?id=e96b3d10ea63fa07d09b",
"/scripts/customizer.js": "/scripts/customizer.js?id=1b0d3cfc1d85f460af53", "/scripts/customizer.js": "/scripts/customizer.js?id=1b0d3cfc1d85f460af53",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=d25f1240496bd3607338" "/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=d25f1240496bd3607338"

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

4
header.php

@ -44,7 +44,11 @@
<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 class="header" role="banner" style="background-image: url(<?php
if ( is_front_page() ) { if ( is_front_page() ) {
if ( has_header_image() ) {
echo( get_header_image() ); echo( get_header_image() );
} else {
echo get_template_directory_uri() . '/dist/images/header.jpg';
}
} else { } else {
echo get_template_directory_uri() . '/dist/images/catalog-header.jpg'; echo get_template_directory_uri() . '/dist/images/catalog-header.jpg';
} ?>);"> } ?>);">

2
inc/actions/namespace.php

@ -63,7 +63,7 @@ function setup() {
// Set up the WordPress core custom header feature. // Set up the WordPress core custom header feature.
add_theme_support( 'custom-header', [ add_theme_support( 'custom-header', [
'default-image' => $assets->getPath( 'images/header.jpg' ), 'default-image' => get_template_directory_uri() . '/dist/images/header.jpg',
'width' => 1920, 'width' => 1920,
'height' => 884, 'height' => 884,
'default-text-color' => '#000', 'default-text-color' => '#000',

7
inc/activation/namespace.php

@ -21,7 +21,7 @@ function create_default_content() {
$home_content = apply_filters( $home_content = apply_filters(
'pb_root_home_page_content', 'pb_root_home_page_content',
sprintf( sprintf(
'<h2>%1$s</h2><p>%2$s</p><p><a class="call-to-action" href="/about/">%3$s</a></p>', '[aldine_page_section title="%1$s"]<p>%2$s</p><p>[aldine_call_to_action link="/about" text="%3$s"]</p>[/aldine_page_section]',
__( 'About Pressbooks', 'pressbooks-aldine' ), __( 'About Pressbooks', 'pressbooks-aldine' ),
__( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ), __( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ),
__( 'Learn More', 'pressbooks-aldine' ) __( 'Learn More', 'pressbooks-aldine' )
@ -69,10 +69,7 @@ function create_default_content() {
], ],
'home' => [ 'home' => [
'post_title' => __( 'Home', 'pressbooks-aldine' ), 'post_title' => __( 'Home', 'pressbooks-aldine' ),
'post_content' => sprintf( 'post_content' => $home_content,
'<div class="page-section">%s</div>',
$home_content
),
], ],
]; ];

2
inc/filters/namespace.php

@ -26,7 +26,7 @@ function body_classes( array $classes ) {
} }
/** Add .has-sections if page content has sections */ /** Add .has-sections if page content has sections */
if ( is_single() || is_page() && has_sections( get_the_ID() ) ) { if ( is_single() || is_front_page() || is_page() && has_sections( get_the_ID() ) ) {
$classes[] = 'has-sections'; $classes[] = 'has-sections';
} }

6
inc/shortcodes/namespace.php

@ -18,7 +18,7 @@ namespace Aldine\Shortcodes;
function page_section( $atts, $content = null ) { function page_section( $atts, $content = null ) {
$atts = shortcode_atts( $atts = shortcode_atts(
[ [
'title' => 'Page Section', 'title' => '',
'variant' => '', 'variant' => '',
], ],
$atts, $atts,
@ -26,9 +26,9 @@ function page_section( $atts, $content = null ) {
); );
return sprintf( return sprintf(
'<div class="page-section%1$s"><h2>%2$s</h2>%3$s</div>', '<div class="page-section%1$s">%2$s%3$s</div>',
( $atts['variant'] ) ? " page-section--{$atts['variant']}" : '', ( $atts['variant'] ) ? " page-section--{$atts['variant']}" : '',
$atts['title'], ( $atts['title'] ) ? "<h2>{$atts['title']}</h2>" : '',
$content $content
); );
} }

11
partials/content-front-page.php

@ -12,6 +12,7 @@
<?php <?php
use function Aldine\Helpers\get_catalog_data; use function Aldine\Helpers\get_catalog_data;
use function Aldine\Helpers\has_sections;
$front_page_catalog = get_option( 'pb_front_page_catalog' ); $front_page_catalog = get_option( 'pb_front_page_catalog' );
$latest_books_title = get_option( 'pb_front_page_catalog_title', __( 'Our Latest Titles', 'pressbooks-aldine' ) ); $latest_books_title = get_option( 'pb_front_page_catalog_title', __( 'Our Latest Titles', 'pressbooks-aldine' ) );
@ -32,7 +33,17 @@ if ( get_option( 'pb_front_page_catalog' ) ) {
<div class="entry-content"> <div class="entry-content">
<?php <?php
if ( has_sections( $post->ID ) ) {
the_content(); the_content();
} else {
echo apply_filters(
'the_content',
sprintf(
'[aldine_page_section]%s[/aldine_page_section]',
get_post_field( 'post_content', $post )
)
);
}
?> ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> --> </article><!-- #post-<?php the_ID(); ?> -->

Loading…
Cancel
Save