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:
Mauricio 2023-03-20 14:52:20 -06:00
commit f21fccf47e
5 changed files with 22 additions and 10 deletions

View File

@ -7,7 +7,6 @@ import wikipediaapi
from bs4 import BeautifulSoup
from django.conf import settings
from django.db import models
from pathlib import Path
from unidecode import unidecode
@ -86,7 +85,7 @@ class MovieQuerySet(models.QuerySet):
all = list(Movie.objects.filter(**kwargs).values())
if len(all) < min_items:
return None
elif len(all) < random_max:
elif len(all) <= random_max:
return all
else:
return random.sample(all, random_max)
@ -173,7 +172,7 @@ class MovieQuerySet(models.QuerySet):
movie["count_formatted"] = self.format_count(movie["count"])
movie["stars_icons"] = self.format_stars(movie["stars"])
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:
movie["wiki"] = self.get_wiki(movie)
@ -182,16 +181,16 @@ class MovieQuerySet(models.QuerySet):
Enmienda ruta a medio.
"""
if not file_name:
return ''
return ""
letter = file_name[0].upper()
if letter.isdigit():
letter = '0'
letter = "0"
url = f"{settings.URL_CDN}/{letter}/{file_name}"
return url
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}"
path = Path(f"{settings.MEDIA_ROOT}{file_name}")
@ -200,7 +199,6 @@ class MovieQuerySet(models.QuerySet):
return url
def fix_summ(self, raw):
"""
Enmienda sinopsis de Wikipedia.

View File

@ -263,6 +263,9 @@
top: 0;
left: 0;
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 */

View File

@ -1,9 +1,16 @@
// Deshabilita scroll con la tecla de espacio
// Esto es para que en 'player' quede habilitado para reproducción
window.addEventListener('keydown', (e) => {
if (e.keyCode === 32 && e.target === document.body) {
e.preventDefault();
}
if (e.keyCode === 32) {
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

View File

@ -259,6 +259,9 @@
top: 0;
left: 0;
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 */

View File

@ -5,6 +5,7 @@
<div class="hero-body">
<form id="login-form" method="post">
{% 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="Contraseña" type="password" name="password" autocomplete="current-password" required="" id="id_password">
<button class="button is-primary" type="submit">Ingresa</button>