Browse Source

Add classes for nav primary menu items and footer items (#273)

* Add classes for nav primary menu items and footer items
* Change variable name
* Update Pressbooks support link URL & WP version in pipeline

Co-authored-by: SteelWagstaff <steel@pressbooks.com>
pull/276/head
Ricardo Aragon 3 years ago committed by GitHub
parent
commit
956df18b4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/.pipeline.yml
  2. 4
      dist/mix-manifest.json
  3. 2
      dist/scripts/aldine.js
  4. 10
      dist/scripts/aldine.js.LICENSE.txt
  5. 2
      dist/scripts/catalog-admin.js
  6. 10
      dist/scripts/catalog-admin.js.LICENSE.txt
  7. 4
      footer.php
  8. 66
      inc/helpers/namespace.php

2
.github/workflows/.pipeline.yml

@ -13,7 +13,7 @@ jobs:
matrix:
php: [ 7.3 ]
os: [ ubuntu-18.04 ]
wordpress: [ 5.7.2, latest ]
wordpress: [ 5.8, latest ]
name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}

4
dist/mix-manifest.json vendored

@ -1,7 +1,7 @@
{
"/scripts/aldine.js": "/scripts/aldine.js?id=d1502669a08aba6476ef",
"/scripts/aldine.js": "/scripts/aldine.js?id=5c7f11a799783d9738e0",
"/scripts/call-to-action.js": "/scripts/call-to-action.js?id=33370b66c7af12320fc0",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=c750be8d290dd92a61a5",
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=e8d84fb090536b8e49e9",
"/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",

2
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

10
dist/scripts/aldine.js.LICENSE.txt vendored

@ -29,14 +29,14 @@
*/
/*!
* Sizzle CSS Selector Engine v2.3.5
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2020-03-14
* Date: 2021-02-16
*/
/*!
@ -46,15 +46,15 @@
*/
/*!
* jQuery JavaScript Library v3.5.1
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2020-05-04T22:49Z
* Date: 2021-03-02T17:08Z
*/

2
dist/scripts/catalog-admin.js vendored

File diff suppressed because one or more lines are too long

10
dist/scripts/catalog-admin.js.LICENSE.txt vendored

@ -1,24 +1,24 @@
/*!
* Sizzle CSS Selector Engine v2.3.5
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2020-03-14
* Date: 2021-02-16
*/
/*!
* jQuery JavaScript Library v3.5.1
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2020-05-04T22:49Z
* Date: 2021-03-02T17:08Z
*/

4
footer.php

@ -103,9 +103,9 @@ if ( $pb_network_contact_form ) {
<?php /* translators: %s Pressbooks */ ?>
<p class="footer__pressbooks__links__title"><a href="https://pressbooks.com"><?php printf( __( 'Powered by %s', 'pressbooks-aldine' ), '<span class="pressbooks">Pressbooks</span>' ); ?></a></p>
<ul class="footer__pressbooks__links__list">
<li><a href="https://pressbooks.education/help-and-support/"><?php _e( 'Guides and Tutorials', 'pressbooks-aldine' ); ?></a></li>
<li class="footer__pressbooks__links__list-item footer__pressbooks__links__list-item-guide-tutorials"><a href="https://pressbooks.com/support/"><?php _e( 'Guides and Tutorials', 'pressbooks-aldine' ); ?></a></li>
<?php if ( $contact_link ) : ?>
<li>|<a href="<?php echo $contact_link; ?>"><?php _e( 'Contact', 'pressbooks-aldine' ); ?></a></li>
<li class="footer__pressbooks__links__list-item footer__pressbooks__links__list-item-contact">|<a href="<?php echo $contact_link; ?>"><?php _e( 'Contact', 'pressbooks-aldine' ); ?></a></li>
<?php endif; ?>
</ul>
</div>

66
inc/helpers/namespace.php

@ -167,64 +167,94 @@ function get_available_subjects( $catalog_data ) {
* @return string $items
*/
function get_default_menu( $items = '' ) {
$item_classes = [
'prefix' => 'nav--primary-item',
'Home' => 'home',
'Contact' => 'contact',
'SignIn' => 'sign-in',
'SignUp' => 'sign-up',
'Admin' => 'admin',
'CreateANewBook' => 'create-book',
'MyBooks' => 'my-books',
'SignOut' => 'sign-out',
];
$link = ( is_front_page() ) ? network_home_url( '#main' ) : network_home_url( '/' );
$items = sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
$link,
__( 'Home', 'pressbooks-aldine' )
__( 'Home', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['Home']
) . $items;
if ( get_option( 'pb_network_contact_form' ) ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
'#contact',
__( 'Contact', 'pressbooks-aldine' )
__( 'Contact', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['Contact']
);
}
if ( ! is_user_logged_in() ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
wp_login_url( get_permalink() ),
__( 'Sign In', 'pressbooks-aldine' )
__( 'Sign In', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['SignIn']
);
if ( in_array( get_site_option( 'registration' ), [ 'user', 'all' ], true ) ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
network_home_url( '/wp-signup.php' ),
__( 'Sign Up', 'pressbooks-aldine' )
__( 'Sign Up', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['SignUp']
);
}
} else {
if ( is_super_admin() || is_user_member_of_blog() ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
admin_url(),
__( 'Admin', 'pressbooks-aldine' )
__( 'Admin', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['Admin']
);
} else {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
user_admin_url(),
__( 'Admin', 'pressbooks-aldine' )
__( 'Admin', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['Admin']
);
}
$user_info = get_userdata( get_current_user_id() );
if ( $user_info->primary_blog ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
get_blogaddress_by_id( $user_info->primary_blog ) . 'wp-admin/index.php?page=pb_catalog',
__( 'My Books', 'pressbooks-aldine' )
__( 'My Books', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['MyBooks']
);
} elseif ( in_array( get_site_option( 'registration' ), [ 'blog', 'all' ], true ) ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
network_home_url( '/wp-signup.php' ),
__( 'Create a New Book', 'pressbooks-aldine' )
__( 'Create a New Book', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['CreateANewBook']
);
}
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>',
wp_logout_url( get_permalink() ),
__( 'Sign Out', 'pressbooks-aldine' )
__( 'Sign Out', 'pressbooks-aldine' ),
$item_classes['prefix'],
$item_classes['SignOut']
);
}
/* @codingStandardsIgnoreStart $items .= sprintf(

Loading…
Cancel
Save