From 8cb7540b97b8aa2e6820d65692def82e57ea6f07 Mon Sep 17 00:00:00 2001 From: Herb Miller Date: Sat, 1 Oct 2022 15:08:46 +0100 Subject: [PATCH] Improve Accordion display for Templates, Template parts and Patterns #11 --- css/oik-themes.css | 6 +++- includes/class-oik-themes-content.php | 44 ++++++++++++++------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/css/oik-themes.css b/css/oik-themes.css index 006b2f2..0bde9f9 100644 --- a/css/oik-themes.css +++ b/css/oik-themes.css @@ -1,4 +1,4 @@ -/* (C) Copyright Bobbing Wide 2015, 2016 */ +/* (C) Copyright Bobbing Wide 2015, 2016, 2022 */ /* Styling for the output of oik-themes to be similar to wordpress.org for the TwentyTwelve theme and different for Genesis based themes */ @@ -57,4 +57,8 @@ div.theme-info:after { clear: left; } } +.bw_accordion_item pre { + overflow: auto; + font-size: 0.8em; +} diff --git a/includes/class-oik-themes-content.php b/includes/class-oik-themes-content.php index 44fe054..b8e8042 100644 --- a/includes/class-oik-themes-content.php +++ b/includes/class-oik-themes-content.php @@ -713,11 +713,11 @@ function list_files($files) { } function accordion( $files, $type ) { - oik_require( "shortcodes/oik-jquery.php" ); - bw_jquery_enqueue_script( "jquery-ui-accordion" ); - bw_jquery_enqueue_style( "jquery-ui-accordion" ); + //oik_require( "shortcodes/oik-jquery.php" ); + //bw_jquery_enqueue_script( "jquery-ui-accordion" ); + //bw_jquery_enqueue_style( "jquery-ui-accordion" ); $selector = $this->bw_accordion_id(); - bw_jquery( "#$selector", "accordion", '{ heightStyle: "content"}' ); + //bw_jquery( "#$selector", "accordion", '{ heightStyle: "content"}' ); $class = "bw_accordion"; sdiv( $class, $selector ); @@ -730,23 +730,25 @@ function accordion( $files, $type ) { return bw_ret(); } - function format_accordion( $file, $type=null ) { - //bw_format_accordion() - h3( basename( $file ) ); - $contents = file_get_contents( $file ); - $contents = str_replace( '[', '[', $contents); - //bw_geshi_it() - sdiv(); - if ( 'patterns' === $type ) { - $this->preview_pattern($file, $contents); - } - stag( 'pre', 'pattern'); - e( esc_html( $contents )); - etag( 'pre'); - - ediv(); - - + function format_accordion( $file, $type=null ) { + sdiv('bw_accordion_item'); + stag('details'); + stag('summary'); + e(basename($file)); + etag('summary'); + $contents = file_get_contents($file); + $contents = str_replace('[', '[', $contents); + //bw_geshi_it() + sdiv(); + if ('patterns' === $type) { + $this->preview_pattern($file, $contents); + } + stag('pre', 'pattern'); + e(esc_html($contents)); + etag('pre'); + ediv(); + etag('details'); + ediv(); } function preview_pattern( $file, $contents ) {