Hides vue components for cards and list for now. Keeps search-control visible based on totalItems

This commit is contained in:
mateuswetah 2018-05-28 17:28:25 -03:00
parent 065e74f7c5
commit 73b38a3abf
2 changed files with 21 additions and 11 deletions

View File

@ -100,7 +100,7 @@
:pref-table-fields="prefTableFields"
:is-on-theme="isOnTheme"
:status="status"
:has-results="items.length > 0"
:has-results="totalItems || items.length > 0"
:view-mode="viewMode"/>
<!-- <div
@ -111,15 +111,19 @@
<b-loading
:is-full-page="false"
:active.sync="isLoadingItems"/>
<items-list
v-if="(viewMode == 'table' || viewMode == 'undefined' || viewMode == '') && !isLoadingItems && items.length > 0"
v-if="(viewMode == 'table' || viewMode == undefined || viewMode == '') && !isLoadingItems && items.length > 0"
:collection-id="collectionId"
:table-fields="tableFields"
:items="items"
:is-loading="isLoading"
:is-on-theme="isOnTheme"/>
<div v-html="itemsListTemplate"/>
<div
v-if="viewMode != 'table' && viewMode != undefined && viewMode != ''"
v-html="itemsListTemplate"/>
<!--
<tainacan-cards-list
v-if="viewMode == 'cards' && !isLoadingItems && items.length > 0"
:table-fields="tableFields"
@ -131,9 +135,10 @@
:table-fields="tableFields"
:items="items"
:is-loading="isLoading"/>
-->
<section
v-if="!isLoadingItems && items.length <= 0"
v-if="(viewMode == 'table' || viewMode == undefined || viewMode == '') && !isLoadingItems && items.length <= 0"
class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -170,8 +175,8 @@
import Pagination from '../../components/search/pagination.vue'
import {mapActions, mapGetters} from 'vuex';
import TainacanCardsList from '../../components/item-view-modes/tainacan-cards-list.vue';
import TainacanListList from '../../components/item-view-modes/tainacan-list-list.vue';
// import TainacanCardsList from '../../components/item-view-modes/tainacan-cards-list.vue';
// import TainacanListList from '../../components/item-view-modes/tainacan-list-list.vue';
export default {
name: 'ItemsPage',
@ -199,8 +204,8 @@
ItemsList,
FiltersItemsList,
Pagination,
TainacanCardsList,
TainacanListList
// TainacanCardsList,
// TainacanListList
},
methods: {
...mapGetters('collection', [
@ -222,7 +227,8 @@
...mapGetters('search', [
'getSearchQuery',
'getStatus',
'getViewMode'
'getViewMode',
'getTotalItems'
]),
updateSearch() {
this.$eventBusSearch.setSearchQuery(this.futureSearchQuery);
@ -332,6 +338,9 @@
itemsListTemplate() {
return this.getItemsListTemplate();
},
totalItems() {
return this.getTotalItems();
},
filters() {
return this.getFilters();
},

View File

@ -126,7 +126,8 @@ export default {
this.$emit( 'hasToPrepareFieldsAndFilters');
else {
this.$emit( 'isLoadingItems', true);
this.$store.dispatch('collection/fetchItems', { 'collectionId': this.collectionId, 'isOnTheme': (this.$route.name == null) }).then((res) => {
this.$store.dispatch('collection/fetchItems', { 'collectionId': this.collectionId, 'isOnTheme': (this.$route.name == null) })
.then((res) => {
this.$emit( 'isLoadingItems', false);
this.$emit( 'hasFiltered', res.hasFiltered);
//var event = new Event('tainacan-items-change')