Skip to content

Commit

Permalink
Merge pull request #109 from bu-ist/release/1.3.4
Browse files Browse the repository at this point in the history
Release 1.3.4
  • Loading branch information
jdub233 committed Nov 10, 2021
2 parents ab1abc9 + 9c9ff65 commit 1441645
Show file tree
Hide file tree
Showing 21 changed files with 47,284 additions and 3,653 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
[
"@babel/plugin-proposal-class-properties"
]
]
}
11 changes: 4 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ exclude_patterns:
- tests/
- vendor/
- node_modules/
- build/
- "**.min.css"
- "**.min.js"
- "js/jquery-ui-classic.css"
- "js/jquery-ui-fresh.css"

prepare:
fetch:
- "https://raw.githubusercontent.com/bu-ist/coding-standards/master/code-climate-rule-sets/.eslintrc"
- "https://raw.githubusercontent.com/bu-ist/coding-standards/master/code-climate-rule-sets/.eslintignore"
- "https://raw.githubusercontent.com/bu-ist/coding-standards/master/code-climate-rule-sets/.mdlrc"
- "https://raw.githubusercontent.com/bu-ist/coding-standards/master/code-climate-rule-sets/markdown.rb"

plugins:
csslint:
enabled: false
Expand All @@ -34,6 +28,9 @@ plugins:
enabled: true
markdownlint:
enabled: true
checks:
MD013:
enabled: false
phpcodesniffer:
enabled: true
config:
Expand Down
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ],
"ignorePatterns": ["webpack.config.js", "build/**/*.js", "**/vendor/**"]
}
7 changes: 5 additions & 2 deletions bu-navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: Boston University (IS&T)
* Author URI: http://sites.bu.edu/web/
* Description: Provides alternative navigation elements designed for blogs with large page counts
* Version: 1.3.3
* Version: 1.3.4
* Text Domain: bu-navigation
* Domain Path: /languages
* License: GPL2+
Expand Down Expand Up @@ -65,6 +65,9 @@
require_once BU_NAV_PLUGIN_DIR . '/composer-includes/bu-navigation-core-widget/src/filters.php';
require_once BU_NAV_PLUGIN_DIR . '/composer-includes/bu-navigation-core-widget/src/class-navigation-widget.php';

// Include Block root file.
require_once BU_NAV_PLUGIN_DIR . '/src/block.php';

/**
* Convenience class to wrap loading and init functions.
*/
Expand All @@ -91,7 +94,7 @@ class BU_Navigation_Plugin {
*
* @var string
*/
const VERSION = '1.3.3';
const VERSION = '1.3.4';

/**
* Plugin class constructor.
Expand Down
1 change: 1 addition & 0 deletions build/block.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'ece016c685cc98b2634e03512a27ecfe');
1 change: 1 addition & 0 deletions build/block.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wp-block-bu-navigation-navigation-block{border:1px dotted #dbdbdb;padding:.5em}
1 change: 1 addition & 0 deletions build/block.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function list_pages( $args = '' ) {
$pages_by_parent = pages_by_parent( $pages );

if ( $parsed_args['widget'] && 'adaptive' === $parsed_args['style'] ) {
$pages_by_parent = adaptive_pages_filter( $pages_by_parent );
$pages_by_parent = adaptive_pages_filter( $pages_by_parent, (int) $parsed_args['page_id'] );
}

$sections = ! empty( $parsed_args['sections'] ) ? $parsed_args['sections'] : array_keys( $pages_by_parent );
Expand Down
11 changes: 8 additions & 3 deletions composer-includes/bu-navigation-core-widget/src/data-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,22 @@ function adaptive_pages_args( $args ) {
* centered around the current post
*
* @param array $pages_by_parent Array of parents and children in the form of a 'section'.
* @param int $page_id ID of the root post of navigation tree.
* @return array Transformed array for adaptive mode.
*/
function adaptive_pages_filter( $pages_by_parent ) {
function adaptive_pages_filter( $pages_by_parent, $page_id = null ) {
global $post;

// The block can specify a different root than the current post,
// so if the page_id parameter is different from the global post fetch the root post based on the passed $page_id parameter.
$root_post = ( $page_id && $post->ID !== $page_id ) ? get_post( $page_id ) : $post;

$filtered = array();
$display_has_children = array_key_exists( $post->ID, $pages_by_parent ) && ( count( $pages_by_parent[ $post->ID ] ) > 0 );
$display_has_children = array_key_exists( $root_post->ID, $pages_by_parent ) && ( count( $pages_by_parent[ $root_post->ID ] ) > 0 );

foreach ( $pages_by_parent as $parent_id => $children ) {

$adaptive_children = adaptive_filter_children( $children, $display_has_children, $post );
$adaptive_children = adaptive_filter_children( $children, $display_has_children, $root_post );

if ( count( $adaptive_children ) > 0 ) {
$filtered[ $parent_id ] = $adaptive_children;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
],
"require": {
"bu-ist/bu-navigation-core-widget": "1.0.3"
"bu-ist/bu-navigation-core-widget": "1.0.4"
},
"extra": {
"installer-paths": {
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1441645

Please sign in to comment.