Merge pull request 'Arreglos UX: top, títulos, login, tecla rápida' (#17) from develop into master
Reviewed-on: #17
This commit is contained in:
commit
f21fccf47e
|
@ -7,7 +7,6 @@ import wikipediaapi
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from pathlib import Path
|
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ class MovieQuerySet(models.QuerySet):
|
||||||
all = list(Movie.objects.filter(**kwargs).values())
|
all = list(Movie.objects.filter(**kwargs).values())
|
||||||
if len(all) < min_items:
|
if len(all) < min_items:
|
||||||
return None
|
return None
|
||||||
elif len(all) < random_max:
|
elif len(all) <= random_max:
|
||||||
return all
|
return all
|
||||||
else:
|
else:
|
||||||
return random.sample(all, random_max)
|
return random.sample(all, random_max)
|
||||||
|
@ -173,7 +172,7 @@ class MovieQuerySet(models.QuerySet):
|
||||||
movie["count_formatted"] = self.format_count(movie["count"])
|
movie["count_formatted"] = self.format_count(movie["count"])
|
||||||
movie["stars_icons"] = self.format_stars(movie["stars"])
|
movie["stars_icons"] = self.format_stars(movie["stars"])
|
||||||
movie["file_name"] = self._fix_path_movie(movie["file_name"])
|
movie["file_name"] = self._fix_path_movie(movie["file_name"])
|
||||||
movie["cartel"] = self._fix_path_cartel(movie['cartel'])
|
movie["cartel"] = self._fix_path_cartel(movie["cartel"])
|
||||||
if wikipedia:
|
if wikipedia:
|
||||||
movie["wiki"] = self.get_wiki(movie)
|
movie["wiki"] = self.get_wiki(movie)
|
||||||
|
|
||||||
|
@ -182,16 +181,16 @@ class MovieQuerySet(models.QuerySet):
|
||||||
Enmienda ruta a medio.
|
Enmienda ruta a medio.
|
||||||
"""
|
"""
|
||||||
if not file_name:
|
if not file_name:
|
||||||
return ''
|
return ""
|
||||||
|
|
||||||
letter = file_name[0].upper()
|
letter = file_name[0].upper()
|
||||||
if letter.isdigit():
|
if letter.isdigit():
|
||||||
letter = '0'
|
letter = "0"
|
||||||
url = f"{settings.URL_CDN}/{letter}/{file_name}"
|
url = f"{settings.URL_CDN}/{letter}/{file_name}"
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def _fix_path_cartel(self, file_name):
|
def _fix_path_cartel(self, file_name):
|
||||||
""" Si no existe el cartel regresa el default """
|
"""Si no existe el cartel regresa el default"""
|
||||||
url = f"{settings.MEDIA_URL}{file_name}"
|
url = f"{settings.MEDIA_URL}{file_name}"
|
||||||
|
|
||||||
path = Path(f"{settings.MEDIA_ROOT}{file_name}")
|
path = Path(f"{settings.MEDIA_ROOT}{file_name}")
|
||||||
|
@ -200,7 +199,6 @@ class MovieQuerySet(models.QuerySet):
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
def fix_summ(self, raw):
|
def fix_summ(self, raw):
|
||||||
"""
|
"""
|
||||||
Enmienda sinopsis de Wikipedia.
|
Enmienda sinopsis de Wikipedia.
|
||||||
|
|
|
@ -263,6 +263,9 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: opacity 0.3s;
|
transition: opacity 0.3s;
|
||||||
|
-webkit-user-select: none; /* Safari */
|
||||||
|
-ms-user-select: none; /* IE 10 and IE 11 */
|
||||||
|
user-select: none; /* Standard syntax */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show the tooltip text when you mouse over the tooltip container */
|
/* Show the tooltip text when you mouse over the tooltip container */
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
// Deshabilita scroll con la tecla de espacio
|
// Deshabilita scroll con la tecla de espacio
|
||||||
// Esto es para que en 'player' quede habilitado para reproducción
|
// Esto es para que en 'player' quede habilitado para reproducción
|
||||||
window.addEventListener('keydown', (e) => {
|
window.addEventListener('keydown', (e) => {
|
||||||
if (e.keyCode === 32 && e.target === document.body) {
|
if (e.keyCode === 32) {
|
||||||
e.preventDefault();
|
if (e.target === document.body) {
|
||||||
}
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
// Por alguna razón la tecla rápida 'espacio' no funciona en toggle como
|
||||||
|
// la tecla rápida 'k', así que se fuerza para el mismo comportamiento
|
||||||
|
window.dispatchEvent(new KeyboardEvent('keydown', {
|
||||||
|
'key': 'k'
|
||||||
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Añade un aviso
|
// Añade un aviso
|
||||||
|
|
|
@ -259,6 +259,9 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: opacity 0.3s;
|
transition: opacity 0.3s;
|
||||||
|
-webkit-user-select: none; /* Safari */
|
||||||
|
-ms-user-select: none; /* IE 10 and IE 11 */
|
||||||
|
user-select: none; /* Standard syntax */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show the tooltip text when you mouse over the tooltip container */
|
/* Show the tooltip text when you mouse over the tooltip container */
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<div class="hero-body">
|
<div class="hero-body">
|
||||||
<form id="login-form" method="post">
|
<form id="login-form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p class="title">Inicio de sesión</p>
|
||||||
<input class="input is-primary" placeholder="Usuario" type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username">
|
<input class="input is-primary" placeholder="Usuario" type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username">
|
||||||
<input class="input is-primary" placeholder="Contraseña" type="password" name="password" autocomplete="current-password" required="" id="id_password">
|
<input class="input is-primary" placeholder="Contraseña" type="password" name="password" autocomplete="current-password" required="" id="id_password">
|
||||||
<button class="button is-primary" type="submit">Ingresa</button>
|
<button class="button is-primary" type="submit">Ingresa</button>
|
||||||
|
|
Loading…
Reference in New Issue