Skip to content

Commit

Permalink
v0.5.4 - Merge pull request #71 from JoryHogeveen/dev
Browse files Browse the repository at this point in the history
v0.5.4
  • Loading branch information
JoryHogeveen authored May 8, 2019
2 parents 8b0e084 + 6ce7fdc commit a8c7d2e
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 237 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"name": "JoryHogeveen/off-canvas-sidebars",
"type": "wordpress-plugin",
"description": "Add off-canvas sidebars using the Slidebars jQuery plugin",
"keywords": [],
"keywords": [
"wordpress",
"off-canvas-sidebars",
"canvas",
"mobile menu",
"slidebars"
],
"homepage": "https://github.com/JoryHogeveen/off-canvas-sidebars/",
"license": "GPL-2.0+",
"authors": [
Expand Down
3 changes: 2 additions & 1 deletion css/off-canvas-sidebars-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jory Hogeveen <[email protected]>
* @package Off_Canvas_Sidebars
* @since 0.2.0
* @version 0.5.0
* @version 0.5.4
* @preserve
*/

Expand All @@ -16,6 +16,7 @@
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.ocs-credits .inside { padding: 0; margin: 0; }
.ocs-credits .inner { padding-left: 10px; padding-right: 10px; }
.ocs-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }

Expand Down
4 changes: 2 additions & 2 deletions css/off-canvas-sidebars-admin.min.css

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

17 changes: 16 additions & 1 deletion css/off-canvas-sidebars.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jory Hogeveen <[email protected]>
* @package Off_Canvas_Sidebars
* @since 0.2.0
* @version 0.5.0
* @version 0.5.4
* @preserve
*/

Expand Down Expand Up @@ -32,6 +32,21 @@ html.ocs-scroll-lock.ocs-scroll-fixed body {
.ocs-initialized [canvas=container] {
overflow-y: hidden;
height: auto;
min-height: 100vh;
}

.admin-bar [canvas=container] {
min-height: -webkit-calc( 100vh - 32px );
min-height: -moz-calc( 100vh - 32px );
min-height: calc( 100vh - 32px );
}

@media screen and (max-width: 782px) {
.admin-bar [canvas=container] {
min-height: -webkit-calc( 100vh - 46px );
min-height: -moz-calc( 100vh - 46px );
min-height: calc( 100vh - 46px );
}
}


Expand Down
4 changes: 2 additions & 2 deletions css/off-canvas-sidebars.min.css

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

52 changes: 31 additions & 21 deletions includes/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author Jory Hogeveen <[email protected]>
* @package Off_Canvas_Sidebars
* @since 0.1.0
* @version 0.5.3
* @version 0.5.4
* @uses \OCS_Off_Canvas_Sidebars_Base Extends class
*/
final class OCS_Off_Canvas_Sidebars_Frontend extends OCS_Off_Canvas_Sidebars_Base
Expand Down Expand Up @@ -74,8 +74,12 @@ private function default_actions() {
$after_hook = trim( $this->get_settings( 'website_after_hook' ) );

if ( 'genesis' === get_template() ) {
$before_hook = 'genesis_before';
$after_hook = 'genesis_after';
if ( empty( $before_hook ) ) {
$before_hook = 'genesis_before';
}
if ( empty( $after_hook ) ) {
$after_hook = 'genesis_after';
}
} else {
if ( empty( $before_hook ) ) {
$before_hook = 'website_before';
Expand Down Expand Up @@ -248,7 +252,7 @@ public function do_sidebar( $sidebar_id ) {
/**
* Filter nav menu args.
*
* Please note that the theme_location property will be overwritten!
* Please note that the `theme_location` and `echo` properties will be overwritten!
*
* @since 0.3.0
*
Expand All @@ -259,9 +263,9 @@ public function do_sidebar( $sidebar_id ) {
* @param string $sidebar_id The ID of this sidebar as configured in: Appearance > Off-Canvas Sidebars > Sidebars.
* @param array $sidebar_data The sidebar settings.
*/
apply_filters( 'ocs_wp_nav_menu_args', $args, $sidebar_id, $sidebar_data );
$args = apply_filters( 'ocs_wp_nav_menu_args', $args, $sidebar_id, $sidebar_data );

// Force the set theme location.
// Force the theme location.
$args['theme_location'] = 'off-canvas-' . $sidebar_id;
// Force echo.
$args['echo'] = true;
Expand Down Expand Up @@ -352,7 +356,7 @@ public function get_container_attributes() {
'id' => $this->get_settings( 'css_prefix' ) . '-site',
'canvas' => 'container',
'data-ocs-site_close' => (bool) $this->get_settings( 'site_close' ),
'data-ocs-disable_over' => (int) $this->get_settings( 'disable_over' ),
'data-ocs-disable_over' => (int) $this->get_settings( 'disable_over' ),
'data-ocs-hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ),
'data-ocs-scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ),
);
Expand All @@ -379,8 +383,10 @@ public function get_sidebar_attributes( $sidebar_id, $data ) {
$atts['class'] = array();
$atts['class'][] = $prefix . '-slidebar';
$atts['class'][] = $prefix . '-' . $sidebar_id;
$atts['class'][] = 'ocs-slidebar';
$atts['class'][] = 'ocs-' . $sidebar_id;
if ( 'ocs' !== $prefix ) {
$atts['class'][] = 'ocs-slidebar';
$atts['class'][] = 'ocs-' . $sidebar_id;
}
$atts['class'][] = 'ocs-size-' . $data['size'];
$atts['class'][] = 'ocs-location-' . $data['location'];
$atts['class'][] = 'ocs-style-' . $data['style'];
Expand Down Expand Up @@ -443,7 +449,7 @@ public function do_control_trigger( $sidebar_id, $args = array() ) {
public function add_styles_scripts() {

// @todo Validate and use minified files
$suffix = '';//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$suffix = '';//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$version = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? time() : OCS_PLUGIN_VERSION;

// FastClick library https://github.com/ftlabs/fastclick
Expand All @@ -467,17 +473,21 @@ public function add_styles_scripts() {
$sidebars[ $sidebar_id ] = $sidebar_data;
}
}
wp_localize_script( 'off-canvas-sidebars', 'ocsOffCanvasSidebars', array(
'site_close' => (bool) $this->get_settings( 'site_close' ),
'link_close' => (bool) $this->get_settings( 'link_close' ),
'disable_over' => (int) $this->get_settings( 'disable_over' ),
'hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ),
'scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ),
'legacy_css' => (bool) ( 'legacy-css' === $this->get_settings( 'compatibility_position_fixed' ) ),
'css_prefix' => $this->get_settings( 'css_prefix' ),
'sidebars' => $sidebars,
'_debug' => (bool) ( defined( 'WP_DEBUG' ) && WP_DEBUG ),
) );
wp_localize_script(
'off-canvas-sidebars',
'ocsOffCanvasSidebars',
array(
'site_close' => (bool) $this->get_settings( 'site_close' ),
'link_close' => (bool) $this->get_settings( 'link_close' ),
'disable_over' => (int) $this->get_settings( 'disable_over' ),
'hide_control_classes' => (bool) $this->get_settings( 'hide_control_classes' ),
'scroll_lock' => (bool) $this->get_settings( 'scroll_lock' ),
'legacy_css' => (bool) ( 'legacy-css' === $this->get_settings( 'compatibility_position_fixed' ) ),
'css_prefix' => $this->get_settings( 'css_prefix' ),
'sidebars' => $sidebars,
'_debug' => (bool) ( defined( 'WP_DEBUG' ) && WP_DEBUG ),
)
);
}

/**
Expand Down
Loading

0 comments on commit a8c7d2e

Please sign in to comment.