capitalize types
This commit is contained in:
parent
f9578af0e4
commit
e27bd125ac
2 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ function filterChanged() {
|
||||||
const filterValue = document.getElementById('filter-select').value
|
const filterValue = document.getElementById('filter-select').value
|
||||||
options.filter = filterValue
|
options.filter = filterValue
|
||||||
document.querySelectorAll('.film').forEach(film => {
|
document.querySelectorAll('.film').forEach(film => {
|
||||||
if (!options.filter || film.dataset.type.split(',').indexOf(options.filter) > -1) {
|
if (!options.filter || film.dataset.type.toLowerCase().split(',').indexOf(options.filter.toLowerCase()) > -1) {
|
||||||
console.log(film.dataset.type.split(','), film.dataset.type.split(',').indexOf(options.filter))
|
console.log(film.dataset.type.split(','), film.dataset.type.split(',').indexOf(options.filter))
|
||||||
film.style.display = ''
|
film.style.display = ''
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,7 +59,7 @@ def films(request):
|
||||||
context['films'] = models.Film.objects.filter(public=True).order_by('position', 'data__title')
|
context['films'] = models.Film.objects.filter(public=True).order_by('position', 'data__title')
|
||||||
types = []
|
types = []
|
||||||
for f in context['films']:
|
for f in context['films']:
|
||||||
types += f.data['type']
|
types += [t.capitalize() for t in f.data['type']]
|
||||||
types = Counter(types)
|
types = Counter(types)
|
||||||
context['types'] = []
|
context['types'] = []
|
||||||
for t in sorted(types):
|
for t in sorted(types):
|
||||||
|
|
Loading…
Reference in a new issue