Adds default view mode options to repository and terms list.

This commit is contained in:
mateuswetah 2021-11-19 17:24:24 -03:00
parent 0c89eb1528
commit 320dabae91
12 changed files with 182 additions and 52 deletions

View File

@ -108,9 +108,9 @@ blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [
'selector' => blocksy_prefix_selector('.collection-thumbnail', $prefix),
'variableName' => 'thumbnail-size',
'value' => get_theme_mod( $prefix . '_hero_thumbnail_size', [
'mobile' => '120px',
'tablet' => '300px',
'desktop' => '140px',
'mobile' => '110px',
'tablet' => '180px',
'desktop' => '220px',
]),
'unit' => ''
]);

View File

@ -0,0 +1,17 @@
<?php
$view_modes = tainacan_get_default_view_mode_choices();
$options = [
$prefix . 'default_view_mode' => [
'label' => __('Default view mode', 'blocksy'),
'type' => 'ct-select',
'value' => $view_modes['default_view_mode'],
'view' => 'text',
'design' => 'inline',
'sync' => '',
'choices' => blocksy_ordered_keys(
$view_modes['enabled_view_modes']
),
]
];

View File

@ -6,6 +6,7 @@ if (! isset($prefix)) {
$prefix = $prefix . '_';
}
$options = [
$prefix . 'search-control-panel' => [
'label' => __( 'Search control', 'tainacan-blocksy' ),
@ -70,6 +71,15 @@ $options = [
'type' => 'ct-title',
'label' => __( 'View modes', 'tainacan-blocksy' ),
],
blocksy_rand_md5() => [
'type' => 'ct-condition',
'condition' => [
$prefix !== 'tainacan-terms-items_archive_'
],
'options' => blocksy_get_options(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/options/archive-elements/default-view-mode.php' , [
'prefix' => $prefix
], false)
],
$prefix . 'show_inline_view_mode_options' => [
'label' => __( 'Show inline view mode options', 'tainacan-blocksy' ),
'type' => 'ct-switch',

View File

@ -68,4 +68,38 @@ if ( !function_exists('tainacan_blocksy_post_class') ) {
}
add_filter('post_class', 'tainacan_blocksy_post_class');
/**
* Retrieves the current registered view modes on Tainacan plugin and filter some options to offer as default
*
* @return array An associative array with view mode options and the default one
*/
function tainacan_get_default_view_mode_choices() {
$default_view_mode = '';
$enabled_view_modes = [];
if (function_exists('tainacan_get_the_view_modes')) {
$view_modes = tainacan_get_the_view_modes();
$default_view_mode = $view_modes['default_view_mode'];
$enabled_view_modes = [];
foreach ($view_modes['registered_view_modes'] as $key => $view_mode) {
if (!$view_mode['full_screen'])
$enabled_view_modes[$key] = $view_mode['label'];
}
} else {
$default_view_mode = 'masonry';
$enabled_view_modes = [
'masonry' => __('Masonry', 'tainacan-interface'),
'cards' => __('Cards', 'tainacan-interface'),
'table' => __('Table', 'tainacan-interface'),
'grid' => __('Grid', 'tainacan-interface')
];
}
return [
'default_view_mode' => $default_view_mode,
'enabled_view_modes' => $enabled_view_modes
];
}
?>

View File

@ -18,7 +18,6 @@
&:not(.is-fullscreen) {
justify-content: center;
top: -52px !important;
background: transparent !important;
padding: 6px 13px;
@include display-grid;
@ -222,6 +221,10 @@
}
}
:not(.wp-block-tainacan-faceted-search)>.theme-items-list:not(.is-fullscreen) {
top: -52px !important;
}
/* Extra classes applied from customizer */
.page {
&.has-filters-panel-style-boxed #filters-modal .modal-content #filters-items-list {

View File

@ -190,6 +190,11 @@
border-radius: var(--borderRadius, 3px);
}
p:empty {
display: none;
visibility: hidden;
}
// Metadata type textarea has different separator
.multivalue-separator {
color: #cbcbcb;
@ -211,8 +216,23 @@
}
}
.tainacan-compound-group {
padding-top: 0.5em;
padding-left: 1.5rem;
border-left: 1px solid #e0e5eb;
.label {
margin: 0;
padding: 0;
font-style: normal;
}
p {
margin-top: 0rem;
margin-bottom: 0.5rem;
}
&>.multivalue-separator {
margin: 1em auto 1.5em -1.5em;
}
}
.tainacan-relationship-group {
.tainacan-relationship-metadatum {
@ -429,4 +449,10 @@
transform: scale(1);
}
}
/* Items related to this section */
.tainacan-item-section--items-related-to-this .wp-block-tainacan-dynamic-items-list {
margin-top: 0.25em;
margin-bottom: 0.5em;
}
}

View File

@ -33,7 +33,6 @@
.theme-items-list:not(.is-fullscreen) {
justify-content: center;
top: -52px !important;
background: transparent !important;
padding: 6px 13px;
flex-wrap: wrap;
@ -249,6 +248,10 @@
border: 1px solid var(--tainacan-input-border-color);
}
:not(.wp-block-tainacan-faceted-search) > .theme-items-list:not(.is-fullscreen) {
top: -52px !important;
}
/* Extra classes applied from customizer */
.page.has-filters-panel-style-boxed #filters-modal .modal-content #filters-items-list {
border-radius: var(--borderRadius, 3px);
@ -356,6 +359,10 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
}
/* Single Item Page */
.tainacan-item-single-page {
/* Items related to this section */
}
.tainacan-item-single-page .tainacan-item-section {
max-width: var(--block-max-width);
align-self: flex-start;
@ -556,6 +563,11 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
border-radius: var(--borderRadius, 3px);
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata p:empty {
display: none;
visibility: hidden;
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .multivalue-separator {
color: #cbcbcb;
margin: 0 8px;
@ -577,10 +589,26 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .tainacan-compound-group {
padding-top: 0.5em;
padding-left: 1.5rem;
border-left: 1px solid #e0e5eb;
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .tainacan-compound-group .label {
margin: 0;
padding: 0;
font-style: normal;
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .tainacan-compound-group p {
margin-top: 0rem;
margin-bottom: 0.5rem;
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .tainacan-compound-group > .multivalue-separator {
margin: 1em auto 1.5em -1.5em;
}
.tainacan-item-single-page .tainacan-item-single .tainacan-item-section__metadata .tainacan-relationship-group .tainacan-relationship-metadatum .tainacan-relationship-metadatum-header {
display: flex;
align-items: center;
@ -794,4 +822,9 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
transform: scale(1);
}
.tainacan-item-single-page .tainacan-item-section--items-related-to-this .wp-block-tainacan-dynamic-items-list {
margin-top: 0.25em;
margin-bottom: 0.5em;
}
/*# sourceMappingURL=style.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,16 @@
<?php
$page_container_classes = 'page type-page hentry singular';
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-repository-items_archive_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-repository-items_archive_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
$repository_items_prefix = 'tainacan-repository-items_archive';
$_GET['blocksy_prefix'] = $repository_items_prefix;
$filters_panel_size = get_theme_mod('tainacan-repository-items_archive_filters_panel_size', '20%');
$page_container_classes = 'page type-page hentry singular';
$page_container_classes = $page_container_classes . ( get_theme_mod($repository_items_prefix . '_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
$page_container_classes = $page_container_classes . ( get_theme_mod($repository_items_prefix . '_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
$filters_panel_size = get_theme_mod($repository_items_prefix . '_filters_panel_size', '20%');
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
$background_color_palette = get_theme_mod('tainacan-repository-items_archive_items_list_background_palette',
$background_color_palette = get_theme_mod($repository_items_prefix . '_items_list_background_palette',
[
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
@ -21,7 +24,7 @@ $page_container_style .= '--tainacan-item-background-hover-color:' . $background
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
$text_color_palette = get_theme_mod('tainacan-repository-items_archive_items_list_text_palette',
$text_color_palette = get_theme_mod($repository_items_prefix . '_items_list_text_palette',
[
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
@ -46,7 +49,7 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
<div class="tainacan-collection-header__box">
<?php
$hero_elements = get_theme_mod(
'tainacan-repository-items_archive_hero_elements',
$repository_items_prefix . '_hero_elements',
[
[
'id' => 'custom_title',
@ -97,20 +100,20 @@ $page_container_style .= 'background-color: var(--tainacan-background-color, #f8
<div class="entry-content">
<?php
tainacan_the_faceted_search([
'hide_filters' => get_theme_mod('tainacan-repository-items_archive_display_filters_panel', 'yes') == 'no',
'start_with_filters_hidden' => get_theme_mod('tainacan-repository-items_archive_start_with_filters_hidden', 'no') == 'yes',
'hide_hide_filters_button' => get_theme_mod('tainacan-repository-items_archive_show_hide_filters_button', 'yes') == 'no',
'show_filters_button_inside_search_control' => get_theme_mod('tainacan-repository-items_archive_show_filters_button_inside_search_control', 'yes') == 'yes',
'filters_as_modal' => get_theme_mod('tainacan-repository-items_archive_filters_as_modal', 'no') == 'yes',
'hide_search' => get_theme_mod('tainacan-repository-items_archive_show_search', 'yes') == 'no',
'hide_advanced_search' => get_theme_mod('tainacan-repository-items_archive_show_advanced_search', 'yes') == 'no',
'hide_sorting_area' => get_theme_mod('tainacan-repository-items_archive_show_sorting_area', 'yes') == 'no',
'hide_sort_by_button' => get_theme_mod('tainacan-repository-items_archive_show_sort_by_button', 'yes') == 'no',
'hide_displayed_metadata_dropdown' => get_theme_mod('tainacan-repository-items_archive_show_displayed_metadata_dropdown', 'yes') == 'no',
'show_inline_view_mode_options' => get_theme_mod('tainacan-repository-items_archive_show_inline_view_mode_options', 'no') == 'yes',
'show_fullscreen_with_view_modes' => get_theme_mod('tainacan-repository-items_archive_show_fullscreen_with_view_modes', 'no') == 'yes',
'hide_exposers_button' => get_theme_mod('tainacan-repository-items_archive_show_exposers_button', 'yes') == 'no',
'hide_pagination_area' => get_theme_mod('tainacan-repository-items_archive_has_pagination', 'yes') == 'no',
'hide_filters' => get_theme_mod($repository_items_prefix . '_display_filters_panel', 'yes') == 'no',
'start_with_filters_hidden' => get_theme_mod($repository_items_prefix . '_start_with_filters_hidden', 'no') == 'yes',
'hide_hide_filters_button' => get_theme_mod($repository_items_prefix . '_show_hide_filters_button', 'yes') == 'no',
'show_filters_button_inside_search_control' => get_theme_mod($repository_items_prefix . '_show_filters_button_inside_search_control', 'yes') == 'yes',
'filters_as_modal' => get_theme_mod($repository_items_prefix . '_filters_as_modal', 'no') == 'yes',
'hide_search' => get_theme_mod($repository_items_prefix . '_show_search', 'yes') == 'no',
'hide_advanced_search' => get_theme_mod($repository_items_prefix . '_show_advanced_search', 'yes') == 'no',
'hide_sorting_area' => get_theme_mod($repository_items_prefix . '_show_sorting_area', 'yes') == 'no',
'hide_sort_by_button' => get_theme_mod($repository_items_prefix . '_show_sort_by_button', 'yes') == 'no',
'hide_displayed_metadata_dropdown' => get_theme_mod($repository_items_prefix . '_show_displayed_metadata_dropdown', 'yes') == 'no',
'show_inline_view_mode_options' => get_theme_mod($repository_items_prefix . '_show_inline_view_mode_options', 'no') == 'yes',
'show_fullscreen_with_view_modes' => get_theme_mod($repository_items_prefix . '_show_fullscreen_with_view_modes', 'no') == 'yes',
'hide_exposers_button' => get_theme_mod($repository_items_prefix . '_show_exposers_button', 'yes') == 'no',
'hide_pagination_area' => get_theme_mod($repository_items_prefix . '_has_pagination', 'yes') == 'no',
]);
?>
</div>

View File

@ -1,13 +1,16 @@
<?php
$page_container_classes = 'page type-page hentry singular';
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-terms-items_archive_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
$page_container_classes = $page_container_classes . ( get_theme_mod('tainacan-terms-items_archive_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
$terms_items_prefix = 'tainacan-terms-items_archive';
$_GET['blocksy_prefix'] = $terms_items_prefix;
$filters_panel_size = get_theme_mod('tainacan-terms-items_archive_filters_panel_size', '20%');
$page_container_classes = 'page type-page hentry singular';
$page_container_classes = $page_container_classes . ( get_theme_mod($terms_items_prefix . '_filters_panel_background_style', 'boxed') == 'boxed' ? ' has-filters-panel-style-boxed' : '' );
$page_container_classes = $page_container_classes . ( get_theme_mod($terms_items_prefix . '_page_header_background_style', 'boxed') == 'boxed' ? ' has-page-header-style-boxed' : '' );
$filters_panel_size = get_theme_mod($terms_items_prefix . '_filters_panel_size', '20%');
$page_container_style = '--tainacan-filter-menu-width-theme:' . $filters_panel_size . ';';
$background_color_palette = get_theme_mod('tainacan-terms-items_archive_items_list_background_palette',
$background_color_palette = get_theme_mod($terms_items_prefix . '_items_list_background_palette',
[
'color1' => [ 'color' => 'var(--background-color, #f8f9fb)' ],
'color2' => [ 'color' => 'var(--cardBackground, #ffffff)' ],
@ -21,7 +24,7 @@ $page_container_style .= '--tainacan-item-background-hover-color:' . $background
$page_container_style .= '--tainacan-input-background-color:' . $background_color_palette['color4']['color'] . ';';
$page_container_style .= '--tainacan-primary-color:' . $background_color_palette['color5']['color'] . ';';
$text_color_palette = get_theme_mod('tainacan-terms-items_archive_items_list_text_palette',
$text_color_palette = get_theme_mod($terms_items_prefix . '_items_list_text_palette',
[
'color1' => [ 'color' => 'var(--paletteColor1,#3eaf7c)' ],
'color2' => [ 'color' => 'var(--headingColor, rgba(44, 62, 80, 1))' ],
@ -54,7 +57,7 @@ $thumbnail_src = wp_get_attachment_image_src($image, 'full');
<?php
$hero_elements = get_theme_mod(
'tainacan-terms-items_archive_hero_elements',
$terms_items_prefix . '_hero_elements',
[
[
'id' => 'custom_thumbnail',
@ -172,20 +175,21 @@ $thumbnail_src = wp_get_attachment_image_src($image, 'full');
<div class="entry-content">
<?php
tainacan_the_faceted_search([
'hide_filters' => get_theme_mod('tainacan-terms-items_archive_display_filters_panel', 'yes') == 'no',
'start_with_filters_hidden' => get_theme_mod('tainacan-terms-items_archive_start_with_filters_hidden', 'no') == 'yes',
'hide_hide_filters_button' => get_theme_mod('tainacan-terms-items_archive_show_hide_filters_button', 'yes') == 'no',
'show_filters_button_inside_search_control' => get_theme_mod('tainacan-terms-items_archive_show_filters_button_inside_search_control', 'yes') == 'yes',
'filters_as_modal' => get_theme_mod('tainacan-terms-items_archive_filters_as_modal', 'no') == 'yes',
'hide_search' => get_theme_mod('tainacan-terms-items_archive_show_search', 'yes') == 'no',
'hide_advanced_search' => get_theme_mod('tainacan-terms-items_archive_show_advanced_search', 'yes') == 'no',
'hide_sorting_area' => get_theme_mod('tainacan-terms-items_archive_show_sorting_area', 'yes') == 'no',
'hide_sort_by_button' => get_theme_mod('tainacan-terms-items_archive_show_sort_by_button', 'yes') == 'no',
'hide_displayed_metadata_dropdown' => get_theme_mod('tainacan-terms-items_archive_show_displayed_metadata_dropdown', 'yes') == 'no',
'show_inline_view_mode_options' => get_theme_mod('tainacan-terms-items_archive_show_inline_view_mode_options', 'no') == 'yes',
'show_fullscreen_with_view_modes' => get_theme_mod('tainacan-terms-items_archive_show_fullscreen_with_view_modes', 'no') == 'yes',
'hide_exposers_button' => get_theme_mod('tainacan-terms-items_archive_show_exposers_button', 'yes') == 'no',
'hide_pagination_area' => get_theme_mod('tainacan-terms-items_archive_has_pagination', 'yes') == 'no',
'hide_filters' => get_theme_mod($terms_items_prefix . '_display_filters_panel', 'yes') == 'no',
'start_with_filters_hidden' => get_theme_mod($terms_items_prefix . '_start_with_filters_hidden', 'no') == 'yes',
'hide_hide_filters_button' => get_theme_mod($terms_items_prefix . '_show_hide_filters_button', 'yes') == 'no',
'show_filters_button_inside_search_control' => get_theme_mod($terms_items_prefix . '_show_filters_button_inside_search_control', 'yes') == 'yes',
'filters_as_modal' => get_theme_mod($terms_items_prefix . '_filters_as_modal', 'no') == 'yes',
'hide_search' => get_theme_mod($terms_items_prefix . '_show_search', 'yes') == 'no',
'hide_advanced_search' => get_theme_mod($terms_items_prefix . '_show_advanced_search', 'yes') == 'no',
'hide_sorting_area' => get_theme_mod($terms_items_prefix . '_show_sorting_area', 'yes') == 'no',
'hide_sort_by_button' => get_theme_mod($terms_items_prefix . '_show_sort_by_button', 'yes') == 'no',
'hide_displayed_metadata_dropdown' => get_theme_mod($terms_items_prefix . '_show_displayed_metadata_dropdown', 'yes') == 'no',
'show_inline_view_mode_options' => get_theme_mod($terms_items_prefix . '_show_inline_view_mode_options', 'no') == 'yes',
'show_fullscreen_with_view_modes' => get_theme_mod($terms_items_prefix . '_show_fullscreen_with_view_modes', 'no') == 'yes',
'hide_exposers_button' => get_theme_mod($terms_items_prefix . '_show_exposers_button', 'yes') == 'no',
'hide_pagination_area' => get_theme_mod($terms_items_prefix . '_has_pagination', 'yes') == 'no',
'default_view_mode' => get_theme_mod($terms_items_prefix . '_default_view_mode', 'masonry'),
]);
?>
</div>