Collections list controls

This commit is contained in:
Leo Germani 2018-07-06 14:01:56 -03:00
parent 4b4e1163fd
commit 0aa77200cf
2 changed files with 24 additions and 9 deletions

View File

@ -24,17 +24,17 @@
<?php _e('Sorting', 'tainacan-theme'); ?> <?php _e('Sorting', 'tainacan-theme'); ?>
</button> </button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuSorting"> <div class="dropdown-menu" aria-labelledby="dropdownMenuSorting">
<a class="dropdown-item" href="#"><?php _e('Creation date', 'tainacan-theme'); ?></a> <a class="dropdown-item <?php tainacan_active(get_query_var('orderby'), 'date'); ?>" href="<?php echo add_query_arg('orderby', 'date'); ?>"><?php _e('Creation date', 'tainacan-theme'); ?></a>
<a class="dropdown-item" href="#"><?php _e('Title', 'tainacan-theme'); ?></a> <a class="dropdown-item <?php tainacan_active(get_query_var('orderby'), 'title'); ?>" href="<?php echo add_query_arg('orderby', 'title'); ?>"><?php _e('Title', 'tainacan-theme'); ?></a>
</div> </div>
</div> </div>
<button class="btn btn-white bg-white margin-one-column-left"> <a class="btn btn-white bg-white margin-one-column-left <?php tainacan_active(get_query_var('order'), 'ASC'); ?>" href="<?php echo add_query_arg('order', 'ASC'); ?>">
<i class="mdi mdi-sort-ascending"></i> <i class="mdi mdi-sort-ascending"></i>
</button> </a>
<button class="btn btn-white bg-white"> <a class="btn btn-white bg-white <?php tainacan_active(get_query_var('order'), 'DESC'); ?>" href="<?php echo add_query_arg('order', 'DESC'); ?>">
<i class="mdi mdi-sort-descending"></i> <i class="mdi mdi-sort-descending"></i>
</button> </a>
<div class="dropdown margin-one-column-left"> <div class="dropdown margin-one-column-left">
<button class="btn bg-white dropdown-toggle text-black" type="button" id="dropdownMenuViewMode" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn bg-white dropdown-toggle text-black" type="button" id="dropdownMenuViewMode" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -42,9 +42,9 @@
<?php _e('View Mode', 'tainacan-theme'); ?> <?php _e('View Mode', 'tainacan-theme'); ?>
</button> </button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuViewMode"> <div class="dropdown-menu" aria-labelledby="dropdownMenuViewMode">
<a class="dropdown-item" href="#"><?php _e('Table', 'tainacan-theme'); ?></a> <a class="dropdown-item <?php tainacan_active(get_query_var('tainacan_collections_viewmode'), 'table'); ?>" href="<?php echo add_query_arg('tainacan_collections_viewmode', 'table'); ?>"><?php _e('Table', 'tainacan-theme'); ?></a>
<a class="dropdown-item" href="#"><?php _e('Cards', 'tainacan-theme'); ?></a> <a class="dropdown-item <?php tainacan_active(get_query_var('tainacan_collections_viewmode'), 'cards'); ?>" href="<?php echo add_query_arg('tainacan_collections_viewmode', 'cards'); ?>"><?php _e('Cards', 'tainacan-theme'); ?></a>
<a class="dropdown-item" href="#"><?php _e('Grid', 'tainacan-theme'); ?></a> <a class="dropdown-item <?php tainacan_active(get_query_var('tainacan_collections_viewmode'), 'grid'); ?>" href="<?php echo add_query_arg('tainacan_collections_viewmode', 'grid'); ?>"><?php _e('Grid', 'tainacan-theme'); ?></a>
</div> </div>
</div> </div>
@ -60,7 +60,11 @@
<?php //_e('Grid', 'tainacan-theme'); ?> <?php //_e('Grid', 'tainacan-theme'); ?>
</option> </option>
</select> --> </select> -->
<form role="search" class="ml-auto" method="get" id="tainacan-collection-search"> <form role="search" class="ml-auto" method="get" id="tainacan-collection-search">
<input type="hidden" name="orderby" value="<?php echo get_query_var('orderby'); ?>" />
<input type="hidden" name="order" value="<?php echo get_query_var('order'); ?>" />
<input type="hidden" name="tainacan_collections_viewmode" value="<?php echo get_query_var('tainacan_collections_viewmode'); ?>" />
<div class="input-group"> <div class="input-group">
<input class="form-control rounded-0" type="search" name="s" value="<?php echo get_query_var('s'); ?>" placeholder="<?php _e('Search in collection'); ?>" /> <input class="form-control rounded-0" type="search" name="s" value="<?php echo get_query_var('s'); ?>" placeholder="<?php _e('Search in collection'); ?>" />
<span class="input-group-append"> <span class="input-group-append">

View File

@ -253,6 +253,17 @@ add_filter( 'query_vars', function ( $public_query_vars ) {
} ); } );
function tainacan_active($selected, $current = true, $echo = true) {
$return = $selected == $current ? 'active' : '';
if ($echo)
echo $return;
return $return;
}
require get_template_directory() . '/functions/customizer.php'; require get_template_directory() . '/functions/customizer.php';
require get_template_directory() . '/functions/pagination.php'; require get_template_directory() . '/functions/pagination.php';
require get_template_directory() . '/functions/single-functions.php'; require get_template_directory() . '/functions/single-functions.php';