diff --git a/stashr/templates/all_volumes_page.html b/stashr/templates/all_volumes_page.html index f1563da..547bd6f 100644 --- a/stashr/templates/all_volumes_page.html +++ b/stashr/templates/all_volumes_page.html @@ -29,7 +29,7 @@
- +
{% endblock %} @@ -49,6 +49,22 @@ {% block script %} +Vue.component('publisher-item', { + props: ['publisher'], + template: ` + + `, + delimiters: ["[[","]]"], +}) + +Vue.component('rating-item', { + props: ['rating'], + template: ` + + `, + delimiters: ["[[","]]"], +}) + Vue.component('volume-item', { props: ['volume'], template: ` @@ -110,7 +126,7 @@ Vue.component('volume-item', { }) Vue.component('volumes', { - props: ['volumes'], + props: ['volumes', 'ratings', 'publishers'], template: `
@@ -120,23 +136,49 @@ Vue.component('volumes', {
-
-
- - +
+
+
+ + +
+
+ + +
-
- - +
+
+ + +
+
+ + +
@@ -149,18 +191,21 @@ Vue.component('volumes', {
`, - data() { return { loading: true, search: '', filter: '', sorted: 'volume_sort_title'} }, + data() { return { loading: true, search: '', filter: '', sorted: 'volume_sort_title', rating: '', publisher: ''} }, computed: { filteredList() { if (this.sorted.toLowerCase() == 'progress') { return this.volumes .filter(volume => { return volume.volume_name.toLowerCase().includes(this.search.toLowerCase()) }) .filter(volume => { return volume.volume_status.toString().includes(this.filter) }) + .filter(volume => { return volume.publisher.publisher_id.toString().includes(this.publisher) }) .sort((a, b) => (a.volume_have / a.volume_total) - (b.volume_have / b.volume_total)) } else { return this.volumes .filter(volume => { return volume.volume_name.toLowerCase().includes(this.search.toLowerCase()) }) .filter(volume => { return volume.volume_status.toString().includes(this.filter) }) + .filter(volume => { return volume.publisher.publisher_id.toString().includes(this.publisher) }) + .filter(volume => { return volume.volume_age_rating.toString().includes(this.rating) }) .sort((a, b) => a[this.sorted] - b[this.sorted]) } }, @@ -172,11 +217,39 @@ var app = new Vue({ el: '#app', data: { volumesList: [], + ratings: [], + publishers: [], }, created() { - this.getVolumes() + this.getVolumes(); + this.getPublishers(); + this.getRatings(); }, methods:{ + getRatings() { + axios.get('{{ url_for('api.api_get_all_ratings') }}') + .then(res => { + this.ratings = res.data.results; + }) + .catch(err => console.log(err)) + }, + getPublishers() { + axios.get('{{ url_for('api.api_get_all_publishers') }}', { + params: { + offset: this.publishers.length + } + }) + .then(res => { + if(res.data.number_of_page_results > 0) { + res.data.results.forEach(result => { + this.publishers.push(result) + }) + if(this.publishers.length < res.data.number_of_total_results) { + this.getPublishers() + } + } + }) + }, getVolumes() { axios.get('{{ url_for('api.api_get_all_volumes') }}', { params: {