Adds text truncate to terms description in terms items page.
This commit is contained in:
parent
f185bf1f20
commit
16d1043727
|
@ -186,6 +186,7 @@ jQuery( document ).ready(function( $ ) {
|
|||
});
|
||||
|
||||
$( '.tainacan-interface-truncate' ).tainacan_interface_truncate();
|
||||
$( '.tainacan-interface-truncate-term' ).tainacan_interface_truncate_term();
|
||||
$( ".trigger" ).click( function() {
|
||||
$( ".collection-header--share" ).toggleClass( "active" );
|
||||
});
|
||||
|
|
|
@ -46,3 +46,60 @@
|
|||
return minimized_elements;
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
(function($) {
|
||||
$.fn.tainacan_interface_truncate_term = function (settings) {
|
||||
count = 1400;
|
||||
const windowWidth = window.innerWidth;
|
||||
|
||||
if (windowWidth <= 1860)
|
||||
count = 890;
|
||||
|
||||
if (windowWidth <= 1366)
|
||||
count = 580;
|
||||
|
||||
if (windowWidth <= 920)
|
||||
count = 500;
|
||||
|
||||
if (windowWidth <= 768)
|
||||
count = 280;
|
||||
|
||||
var config = {
|
||||
showChars: count,
|
||||
minChars: count,
|
||||
ellipsesText: "...",
|
||||
moreText: tainacan_trucanteVars.moreText,
|
||||
lessText: tainacan_trucanteVars.lessText
|
||||
};
|
||||
|
||||
if (settings) {
|
||||
$.extend( config, settings );
|
||||
}
|
||||
|
||||
var minimized_elements = $( this );
|
||||
|
||||
minimized_elements.each(function(){
|
||||
var t = minimized_elements.html();
|
||||
if (t.length <= config.minChars) { return };
|
||||
|
||||
$( this ).html(
|
||||
t.slice( 0,config.showChars ) + '<span>' + config.ellipsesText + ' </span><a href="#" class="tainacan-interface-more-term">[ ' + config.moreText + ' ]</a>' + '<span style="display:none;">' + t.slice( config.showChars,t.length ) + ' <a href="#" class="tainacan-interface-less-term">[ ' + config.lessText + ' ]</a></span>'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
$( 'a.tainacan-interface-more-term', minimized_elements ).click(function(event){
|
||||
event.preventDefault();
|
||||
minimized_elements.addClass( 'full-story' );
|
||||
$( this ).hide().prev().hide();
|
||||
$( this ).next().show();
|
||||
});
|
||||
|
||||
$( 'a.tainacan-interface-less-term', minimized_elements ).click(function(event){
|
||||
event.preventDefault();
|
||||
minimized_elements.removeClass( 'full-story' );
|
||||
$( this ).parent().hide().prev().show().prev().show();
|
||||
});
|
||||
return minimized_elements;
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
height: 300px;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
background-color: #f2f2f2;
|
||||
@media only screen and (min-width: 641px) and (max-width: 992px) {
|
||||
height: 37.5%;
|
||||
|
@ -99,10 +100,21 @@
|
|||
a {
|
||||
color: #298596;
|
||||
font: {
|
||||
size: 0.875rem;
|
||||
size: inherit;
|
||||
weight: 400;
|
||||
}
|
||||
}
|
||||
&.tainacan-interface-truncate-term {
|
||||
.tainacan-interface-more-term, .tainacan-interface-less-term {
|
||||
color: #4f4f4f;
|
||||
white-space: nowrap;
|
||||
opacity: 0.75;
|
||||
}
|
||||
&.full-story {
|
||||
height: auto;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
> .page-header-share {
|
||||
white-space: nowrap;
|
||||
|
|
|
@ -794,7 +794,7 @@ function tainacan_customize_register( $wp_customize ) {
|
|||
'type' => 'theme_mod',
|
||||
'capability' => 'edit_theme_options',
|
||||
'default' => false,
|
||||
'transport' => 'postMessage'
|
||||
'transport' => 'refresh'
|
||||
) );
|
||||
$wp_customize->add_control( 'tainacan_items_page_show_filters_button_inside_search_control', array(
|
||||
'type' => 'checkbox',
|
||||
|
@ -803,11 +803,6 @@ function tainacan_customize_register( $wp_customize ) {
|
|||
'label' => __( 'Show Filters button inside the search control bar.', 'tainacan-interface' ),
|
||||
'description' => __( 'Toggle to do display the Filters button inside the search control bar.', 'tainacan-interface' )
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial( 'tainacan_items_page_show_filters_button_inside_search_control', array(
|
||||
'selector' => '.theme-items-list #tainacanFiltersButton',
|
||||
'render_callback' => '__return_false',
|
||||
'fallback_refresh' => true
|
||||
) );
|
||||
|
||||
/**
|
||||
* Adds option to start filters hidden by default on every items list.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -33,10 +33,11 @@ $src = wp_get_attachment_image_src($image, 'full');
|
|||
</div>
|
||||
<?php $tainacan_term_description = tainacan_get_the_term_description(); ?>
|
||||
<div class="page-header-hightlights d-flex flex-wrap">
|
||||
<div class="col-12 col-xl-10 col-lg-9 page-header-description">
|
||||
<div class="col-12 col-xl-10 col-lg-9 page-header-description tainacan-interface-truncate-term">
|
||||
<?php echo $tainacan_term_description; ?>
|
||||
<?php do_action( 'tainacan-interface-collection-description' ); ?>
|
||||
</div>
|
||||
<?php do_action( 'tainacan-interface-taxonoy-description' ); ?>
|
||||
<?php do_action( 'tainacan-interface-taxonomy-description' ); ?>
|
||||
<div class="col-12 col-xl-2 col-lg-3 d-flex flex-wrap page-header-share">
|
||||
<div class="page-header-icons">
|
||||
<p class="share-title"><?php _e('Share', 'tainacan-interface'); ?></p>
|
||||
|
|
Loading…
Reference in New Issue