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

Put back in the text input for filtering by show title. #8415

Merged
merged 3 commits into from
Aug 31, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions themes-default/slim/src/components/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,6 @@ export default {
setLayout({ page, layout });
}
},
filterByName: {
get() {
const { local } = this.stateLayout;
const { showFilterByName } = local;

return showFilterByName;
},
set(value) {
const { setLayoutLocal } = this;
setLayoutLocal({ key: 'showFilterByName', value });
}
},
showList: {
get() {
const { stateLayout } = this;
Expand Down
18 changes: 17 additions & 1 deletion themes-default/slim/src/components/show-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<h3 class="header">{{listTitle}}</h3>
</div>
<div class="col-lg-12">
<div class="show-option">
<input type="search" v-model="filterByName" class="form-control form-control-inline input-sm input200" placeholder="Filter Show Name">
</div>
<div class="show-option">
<!-- These need to patch apiv2 on change! -->
<select v-model="posterUiSortDir" id="postersortdirection" class="form-control form-control-inline input-sm" placeholder="Direction">
Expand Down Expand Up @@ -112,6 +115,18 @@ export default {
...mapGetters({
showsInLists: 'showsInLists'
}),
filterByName: {
get() {
const { local } = this.stateLayout;
const { showFilterByName } = local;

return showFilterByName;
},
set(value) {
const { setLayoutLocal } = this;
setLayoutLocal({ key: 'showFilterByName', value });
}
},
mappedLayout() {
const { layout } = this;
if (layout === 'small') {
Expand Down Expand Up @@ -145,7 +160,8 @@ export default {
methods: {
...mapActions({
setPosterSortBy: 'setPosterSortBy',
setPosterSortDir: 'setPosterSortDir'
setPosterSortDir: 'setPosterSortDir',
setLayoutLocal: 'setLayoutLocal'
})
}
};
Expand Down
19 changes: 17 additions & 2 deletions themes-default/slim/src/components/show-list/poster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export default {
borderRadius: null,
borderWidth: null,
isotopeLoaded: false,
imgLazyLoad: null
imgLazyLoad: null,
filterByTitle: ''
};
},
computed: {
Expand All @@ -152,7 +153,8 @@ export default {
posterSortBy: state => state.config.layout.posterSortby,
posterSortDir: state => state.config.layout.posterSortdir,
posterSize: state => state.config.layout.local.posterSize,
currentShowTab: state => state.config.layout.local.currentShowTab
currentShowTab: state => state.config.layout.local.currentShowTab,
showFilterByName: state => state.config.layout.local.showFilterByName
}),
...mapGetters({
fuzzyParseDateTime: 'fuzzyParseDateTime'
Expand Down Expand Up @@ -278,6 +280,19 @@ export default {
this.$nextTick(() => {
this.$refs[`isotope-${listTitle}`].arrange();
});
},
showFilterByName(value) {
const { $refs, listTitle } = this;

const allContainers = $refs[`isotope-${listTitle}`].$el.querySelectorAll('.show-container');

for (const container of allContainers) {
if (container.textContent.toLowerCase().includes(value.toLowerCase())) {
container.classList.remove('hide');
} else {
container.classList.add('hide');
}
}
}
}
};
Expand Down
Loading