Skip to content

Commit

Permalink
Resolve issue with personalBest cube name not displaying, add presets…
Browse files Browse the repository at this point in the history
… at the top of public-pbs page
  • Loading branch information
big213 committed Apr 5, 2021
1 parent 879840d commit c6af9a1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
: item.field
"
></component>
<span v-else>{{ currentItem[item.field] }}</span>
<span v-else>{{
getNestedProperty(currentItem, item.field)
}}</span>
</td>
</tr>
</tbody>
Expand All @@ -60,9 +62,13 @@

<script>
import editRecordInterfaceMixin from '~/mixins/editRecordInterface'
import { getNestedProperty } from '~/services/base'
export default {
mixins: [editRecordInterfaceMixin],
methods: {
getNestedProperty,
},
}
</script>

Expand Down
1 change: 1 addition & 0 deletions frontend/mixins/crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export default {
this.syncFilters()
this.reset({
resetCursor: true,
resetSort: true,
})
},
},
Expand Down
57 changes: 49 additions & 8 deletions frontend/pages/public-pbs.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
<template>
<CrudRecordPage
:record-info="recordInfo"
:locked-filters="lockedFilters"
:hidden-filters="hiddenFilters"
:head="head"
:title="title"
icon="mdi-star"
></CrudRecordPage>
<div>
<div class="text-center pt-3">
<v-chip
v-for="(item, i) in events"
:key="i"
class="ma-2"
@click="applyPresetRoute(item)"
>
<v-avatar left>
<span class="cubing-icon" :class="item.cubingIcon"></span>
</v-avatar>
{{ item.name }}
</v-chip>
</div>

<CrudRecordPage
:record-info="recordInfo"
:locked-filters="lockedFilters"
:hidden-filters="hiddenFilters"
:head="head"
:title="title"
icon="mdi-star"
></CrudRecordPage>
</div>
</template>

<script>
import CrudRecordPage from '~/components/page/crudRecordPage.vue'
import { PublicPbs } from '~/models/special'
import { generateRoute } from '~/services/base'
import { getEvents } from '~/services/dropdown'
export default {
components: {
Expand All @@ -38,7 +56,30 @@ export default {
},
],
title: 'Public PBs',
events: [],
}
},
mounted() {
// load first 18 events only
getEvents(this).then((res) => (this.events = res.slice(0, 18)))
},
methods: {
applyPresetRoute(event) {
this.$router.push(
generateRoute(this.$route.path, {
sortBy: ['happenedOn'],
sortDesc: [true],
filters: [
{
field: 'event.id',
operator: 'eq',
value: event.id,
},
],
})
)
},
},
}
</script>

0 comments on commit c6af9a1

Please sign in to comment.