Adds options to hide total items from item status tabs #659

This commit is contained in:
mateuswetah 2022-02-02 11:18:58 -03:00
parent 943787edf3
commit be6ff6c550
6 changed files with 63 additions and 50 deletions

View File

@ -35,7 +35,7 @@
</button> </button>
<tainacan-header v-if="!$adminOptions.hideTainacanHeader" /> <tainacan-header v-if="!$adminOptions.hideTainacanHeader" />
<tainacan-repository-subheader <tainacan-repository-subheader
v-if="!$adminOptions.hideTainacanRepositorySubheader" v-if="!$adminOptions.hideRepositorySubheader"
:is-repository-level="isRepositoryLevel" :is-repository-level="isRepositoryLevel"
:is-menu-compressed="isMenuCompressed"/> :is-menu-compressed="isMenuCompressed"/>
<div <div

View File

@ -5,7 +5,7 @@
:class="{'is-menu-compressed': isMenuCompressed, 'is-repository-level' : isRepositoryLevel}"> :class="{'is-menu-compressed': isMenuCompressed, 'is-repository-level' : isRepositoryLevel}">
<div <div
v-if="$adminOptions.hideTainacanCollectionSubheader" v-if="$adminOptions.hideCollectionSubheader"
class="back-button is-hidden-mobile"> class="back-button is-hidden-mobile">
<button <button
@click="$router.go(-1)" @click="$router.go(-1)"
@ -18,12 +18,12 @@
<h1 <h1
v-if="isRepositoryLevel" v-if="isRepositoryLevel"
:style="$adminOptions.hideTainacanCollectionSubheader ? 'margin-right: auto;' : ''"> :style="$adminOptions.hideCollectionSubheader ? 'margin-right: auto;' : ''">
{{ repositoryName }} {{ repositoryName }}
</h1> </h1>
<h1 <h1
v-else v-else
:style="$adminOptions.hideTainacanCollectionSubheader ? 'margin-right: auto;' : ''"> :style="$adminOptions.hideCollectionSubheader ? 'margin-right: auto;' : ''">
{{ $i18n.get('collection') + '' }} {{ $i18n.get('collection') + '' }}
<span class="has-text-weight-bold"> <span class="has-text-weight-bold">
{{ collection && collection.name ? collection.name : '' }} {{ collection && collection.name ? collection.name : '' }}
@ -60,7 +60,7 @@
@click="openAvailableExportersModal" @click="openAvailableExportersModal"
class="button" class="button"
id="exporter-collection-button" id="exporter-collection-button"
v-if="!isRepositoryLevel && !$adminOptions.hideTainacanRepositorySubheaderExportButton"> v-if="!isRepositoryLevel && !$adminOptions.hideRepositorySubheaderExportButton">
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-export"/> <i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-export"/>
</span> </span>
@ -80,7 +80,7 @@
<a <a
:href="collection && collection.url ? collection.url : ''" :href="collection && collection.url ? collection.url : ''"
target="_blank" target="_blank"
v-if="!isRepositoryLevel && collection && collection.url && !$adminOptions.hideTainacanRepositorySubheaderViewCollectionButton" v-if="!isRepositoryLevel && collection && collection.url && !$adminOptions.hideRepositorySubheaderViewCollectionButton"
class="button" class="button"
id="view-collection-button"> id="view-collection-button">
<span class="icon"> <span class="icon">
@ -103,7 +103,7 @@
<a <a
:href="repositoryURL" :href="repositoryURL"
target="_blank" target="_blank"
v-if="isRepositoryLevel && !$adminOptions.hideTainacanRepositorySubheaderViewCollectionsButton" v-if="isRepositoryLevel && !$adminOptions.hideRepositorySubheaderViewCollectionsButton"
class="button" class="button"
id="view-repository-button"> id="view-repository-button">
<span class="icon"> <span class="icon">

View File

@ -11,7 +11,11 @@
}"> }">
<a :style="{ fontWeight: 'bold', color: 'var(--tainacan-gray5) !important' }"> <a :style="{ fontWeight: 'bold', color: 'var(--tainacan-gray5) !important' }">
{{ $i18n.get('label_all_items') }} {{ $i18n.get('label_all_items') }}
<span class="has-text-gray">&nbsp;{{ (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.private + repositoryTotalItems.publish + repositoryTotalItems.draft })` : (collection && collection.total_items ? ` (${Number(collection.total_items.private) + Number(collection.total_items.publish) + Number(collection.total_items.draft)})` : '') }}</span> <span
v-if="!$adminOptions.hideItemsStatusTabsTotalItems"
class="has-text-gray">
&nbsp;{{ (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.private + repositoryTotalItems.publish + repositoryTotalItems.draft })` : (collection && collection.total_items ? ` (${Number(collection.total_items.private) + Number(collection.total_items.publish) + Number(collection.total_items.draft)})` : '') }}
</span>
</a> </a>
</li> </li>
<li <li
@ -36,7 +40,11 @@
/> />
</span> </span>
{{ statusOption.name }} {{ statusOption.name }}
<span class="has-text-gray">&nbsp;{{ (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems[statusOption.slug] })` : (collection && collection.total_items ? ` (${collection.total_items[statusOption.slug]})` : '') }}</span> <span
v-if="!$adminOptions.hideItemsStatusTabsTotalItems"
class="has-text-gray">
&nbsp;{{ (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems[statusOption.slug] })` : (collection && collection.total_items ? ` (${collection.total_items[statusOption.slug]})` : '') }}
</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -58,23 +66,28 @@ export default {
return this.getCollection(); return this.getCollection();
}, },
repositoryTotalItems() { repositoryTotalItems() {
let collections = this.getCollections();
let total_items = { if (!this.$adminOptions.hideItemsStatusTabsTotalItems) {
trash: 0, let collections = this.getCollections();
publish: 0,
draft: 0,
private: 0
};
for(let collection of collections){ let total_items = {
total_items.trash += Number(collection.total_items.trash); trash: 0,
total_items.draft += Number(collection.total_items.draft); publish: 0,
total_items.publish += Number(collection.total_items.publish); draft: 0,
total_items.private += Number(collection.total_items.private); private: 0
};
for(let collection of collections){
total_items.trash += Number(collection.total_items.trash);
total_items.draft += Number(collection.total_items.draft);
total_items.publish += Number(collection.total_items.publish);
total_items.private += Number(collection.total_items.private);
}
return total_items;
} else {
return '';
} }
return total_items;
} }
}, },
methods: { methods: {

View File

@ -465,8 +465,8 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
itemsSingleSelectionMode: { itemsSingleSelectionMode: {
hideTainacanHeader: true, hideTainacanHeader: true,
hidePrimaryMenu: true, hidePrimaryMenu: true,
hideTainacanRepositorySubheader: true, hideRepositorySubheader: true,
hideTainacanCollectionSubheader: true, hideCollectionSubheader: true,
hideMultipleItemSelection: true, hideMultipleItemSelection: true,
hideBulkActionsDropdown: true, hideBulkActionsDropdown: true,
hideContextMenuOpenItemOption: true, hideContextMenuOpenItemOption: true,
@ -478,14 +478,14 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
hideItemsListPageTitle: true, hideItemsListPageTitle: true,
hideItemCreationDropdown: true, hideItemCreationDropdown: true,
hideExposersButton: true, hideExposersButton: true,
hideItemsStatusStabs: true, hideItemsStatusTabs: true,
hideFilterCreationButton: true hideFilterCreationButton: true
}, },
itemsMultipleSelectionMode: { itemsMultipleSelectionMode: {
hideTainacanHeader: true, hideTainacanHeader: true,
hidePrimaryMenu: true, hidePrimaryMenu: true,
hideTainacanRepositorySubheader: true, hideRepositorySubheader: true,
hideTainacanCollectionSubheader: true, hideCollectionSubheader: true,
hideMultipleItemSelection: true, hideMultipleItemSelection: true,
hideBulkActionsDropdown: true, hideBulkActionsDropdown: true,
hideContextMenuOpenItemOption: true, hideContextMenuOpenItemOption: true,
@ -497,14 +497,14 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
hideItemsListPageTitle: true, hideItemsListPageTitle: true,
hideItemCreationDropdown: true, hideItemCreationDropdown: true,
hideExposersButton: true, hideExposersButton: true,
hideItemsStatusStabs: true, hideItemsStatusTabs: true,
hideFilterCreationButton: true hideFilterCreationButton: true
}, },
itemsSearchSelectionMode: { itemsSearchSelectionMode: {
hideTainacanHeader: true, hideTainacanHeader: true,
hidePrimaryMenu: true, hidePrimaryMenu: true,
hideTainacanRepositorySubheader: true, hideRepositorySubheader: true,
hideTainacanCollectionSubheader: true, hideCollectionSubheader: true,
hideMultipleItemSelection: true, hideMultipleItemSelection: true,
hideBulkActionsDropdown: true, hideBulkActionsDropdown: true,
hideItemActionArea: true, hideItemActionArea: true,
@ -513,21 +513,21 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
hideExposersButton: true, hideExposersButton: true,
hideContextMenu: true, hideContextMenu: true,
hideItemSelection: true, hideItemSelection: true,
hideItemsStatusStabs: true, hideItemsStatusTabs: true,
hideFilterCreationButton: true hideFilterCreationButton: true
}, },
itemEditionMode: { itemEditionMode: {
hideTainacanHeader: true, hideTainacanHeader: true,
hidePrimaryMenu: true, hidePrimaryMenu: true,
hideTainacanRepositorySubheader: true, hideRepositorySubheader: true,
hideTainacanCollectionSubheader: true, hideCollectionSubheader: true,
hideItemEditionPageBackButton: true hideItemEditionPageBackButton: true
}, },
mobileAppMode: { mobileAppMode: {
hideTainacanHeader: true, hideTainacanHeader: true,
hidePrimaryMenu: true, hidePrimaryMenu: true,
hideTainacanRepositorySubheader: true, hideRepositorySubheader: true,
hideTainacanCollectionSubheader: true, hideCollectionSubheader: true,
hideItemEditionPageBackButton: true, hideItemEditionPageBackButton: true,
hideItemsListPageTitle: true, hideItemsListPageTitle: true,
hideItemEditionPageTitle: true, hideItemEditionPageTitle: true,
@ -566,11 +566,11 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
* hidePrimaryMenuExportersButton * hidePrimaryMenuExportersButton
* hidePrimaryMenuActivitiesButton * hidePrimaryMenuActivitiesButton
* hidePrimaryMenuCapabilitiesButton * hidePrimaryMenuCapabilitiesButton
* hideTainacanRepositorySubheader * hideRepositorySubheader
* hideTainacanRepositorySubheaderViewCollectionButton * hideRepositorySubheaderViewCollectionButton
* hideTainacanRepositorySubheaderViewCollectionsButton * hideRepositorySubheaderViewCollectionsButton
* hideTainacanRepositorySubheaderExportButton * hideRepositorySubheaderExportButton
* hideTainacanCollectionSubheader * hideCollectionSubheader
* hideMultipleItemSelection * hideMultipleItemSelection
* hideItemSelection * hideItemSelection
* hideBulkActionsDropdown * hideBulkActionsDropdown
@ -582,13 +582,13 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
* hideContextMenuDeleteItemOption * hideContextMenuDeleteItemOption
* hideItemActionArea * hideItemActionArea
* hideItemsListPageTitle * hideItemsListPageTitle
* hideItemCreationDropdown
* hideExposersButton
* hideItemsStatusStabs
* hideFilterCreationButton
* hideItemEditionPageBackButton
* hideItemEditionPageTitle * hideItemEditionPageTitle
* hideBulkEditionPageTitle * hideBulkEditionPageTitle
* hideItemCreationDropdown
* hideExposersButton
* hideItemsStatusTabs
* hideFilterCreationButton
* hideItemEditionPageBackButton
* hideCollectionNameInItemPage * hideCollectionNameInItemPage
*/ */
}; };

View File

@ -496,7 +496,7 @@
<!-- STATUS TABS, only on Admin -------- --> <!-- STATUS TABS, only on Admin -------- -->
<items-status-tabs <items-status-tabs
v-if="!openAdvancedSearch && !$adminOptions.hideItemsStatusStabs" v-if="!openAdvancedSearch && !$adminOptions.hideItemsStatusTabs"
:is-repository-level="isRepositoryLevel"/> :is-repository-level="isRepositoryLevel"/>
<!-- FILTERS TAG LIST--> <!-- FILTERS TAG LIST-->

View File

@ -4,13 +4,13 @@
:class="{ 'tainacan-admin-collection-mobile-app-mode': $adminOptions.mobileAppMode }"> :class="{ 'tainacan-admin-collection-mobile-app-mode': $adminOptions.mobileAppMode }">
<section <section
class="column is-secondary-content" class="column is-secondary-content"
:style="$adminOptions.hideTainacanRepositorySubheader ? 'margin-top: 0; height: 100%;' : ''"> :style="$adminOptions.hideRepositorySubheader ? 'margin-top: 0; height: 100%;' : ''">
<tainacan-collection-subheader v-if="!$adminOptions.hideTainacanCollectionSubheader" /> <tainacan-collection-subheader v-if="!$adminOptions.hideCollectionSubheader" />
<router-view <router-view
id="collection-page-container" id="collection-page-container"
:collection-id="collectionId" :collection-id="collectionId"
class="page-container" class="page-container"
:class="{ 'page-container-small': !$adminOptions.hideTainacanRepositorySubheader }"/> :class="{ 'page-container-small': !$adminOptions.hideRepositorySubheader }"/>
</section> </section>
</div> </div>
</template> </template>