Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Materialfilter PeriodOnly in ContentNode #4361 #4366

Merged
merged 7 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/activity/content/Material.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:layout-mode="layoutMode"
:material-item-collection="materialItemCollection"
:disabled="disabled"
hide-period-filter
/>
</ContentNodeCard>
</template>
Expand Down
24 changes: 22 additions & 2 deletions frontend/src/components/material/MaterialTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@

<template #[`header.lastColumn`]>
<button
v-if="!hidePeriodFilter"
class="ec-material-table__filterbutton"
:class="{ 'primary--text': periodOnly }"
:disabled="layoutMode"
:disabled="layoutMode || !periodFilterEnabled"
@click="periodOnly = !periodOnly"
>
<span>
Expand All @@ -157,7 +158,12 @@
: $tc('components.material.materialTable.reference')
}}
</span>
<v-icon aria-hidden="true" small :color="periodOnly ? 'primary' : null">
<v-icon
v-if="periodFilterEnabled"
aria-hidden="true"
small
:color="periodOnly ? 'primary' : null"
>
{{ periodOnly ? 'mdi-filter' : 'mdi-filter-outline' }}
</v-icon>
</button>
Expand Down Expand Up @@ -252,6 +258,9 @@ export default {

// period Entity for displaying material items within a period (should be null if materialNode is provided)
period: { type: Object, required: false, default: null },

// Hide the filter button activity / period
hidePeriodFilter: { type: Boolean, required: false, default: false },
},
data() {
return {
Expand Down Expand Up @@ -367,6 +376,17 @@ export default {
isDefaultVariant() {
return this.clientWidth > 710
},
// Show filter just if period material is in the list
periodFilterEnabled() {
return this.materialItemCollection.items.some((item) => item.materialNode === null)
},
},
watch: {
periodFilterEnabled() {
if (!this.periodFilterEnabled) {
this.periodOnly = false
}
},
},
mounted() {
this.clientWidth = this.$el.clientWidth
Expand Down