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>
<tainacan-header v-if="!$adminOptions.hideTainacanHeader" />
<tainacan-repository-subheader
v-if="!$adminOptions.hideTainacanRepositorySubheader"
v-if="!$adminOptions.hideRepositorySubheader"
:is-repository-level="isRepositoryLevel"
:is-menu-compressed="isMenuCompressed"/>
<div

View File

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

View File

@ -11,7 +11,11 @@
}">
<a :style="{ fontWeight: 'bold', color: 'var(--tainacan-gray5) !important' }">
{{ $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>
</li>
<li
@ -36,7 +40,11 @@
/>
</span>
{{ 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>
</li>
</ul>
@ -58,23 +66,28 @@ export default {
return this.getCollection();
},
repositoryTotalItems() {
let collections = this.getCollections();
let total_items = {
trash: 0,
publish: 0,
draft: 0,
private: 0
};
if (!this.$adminOptions.hideItemsStatusTabsTotalItems) {
let collections = this.getCollections();
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);
let total_items = {
trash: 0,
publish: 0,
draft: 0,
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: {

View File

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

View File

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

View File

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