Spaces:
Sleeping
Sleeping
Se remueve la modificacion de vocabularios
Browse files- tecnicas/controllers/__init__.py +1 -0
- tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py +17 -66
- tecnicas/controllers/views_controller/vocabulary_manage/list_vocabulary_controller.py +1 -1
- tecnicas/controllers/views_controller/vocabulary_manage/view_vocabulary_controller.py +28 -0
- tecnicas/static/img/words.webp +0 -0
- tecnicas/static/js/created-vocabulary.js +1 -23
- tecnicas/templates/tecnicas/components/item_vocabulary.html +2 -2
- tecnicas/templates/tecnicas/manage_vocabulary/create-vocabulary.html +0 -17
- tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html +2 -2
- tecnicas/templates/tecnicas/manage_vocabulary/view-vocabulary.html +85 -0
- tecnicas/urls.py +4 -0
- tecnicas/views/__init__.py +1 -0
- tecnicas/views/vocabulary_management/view_vocabulary.py +13 -0
tecnicas/controllers/__init__.py
CHANGED
|
@@ -56,6 +56,7 @@ from .views_controller.sessions_tester.init_session.init_session_sort_controller
|
|
| 56 |
from .views_controller.sessions_tester.init_session.init_session_napping_controller import InitSessionNappingController
|
| 57 |
|
| 58 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
|
|
|
| 59 |
from .views_controller.vocabulary_manage.list_vocabulary_controller import ListVocabularyController
|
| 60 |
|
| 61 |
from .api_controller.rating_sacales_controller import RatingScalesController
|
|
|
|
| 56 |
from .views_controller.sessions_tester.init_session.init_session_napping_controller import InitSessionNappingController
|
| 57 |
|
| 58 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
| 59 |
+
from .views_controller.vocabulary_manage.view_vocabulary_controller import ViewVocabularyController
|
| 60 |
from .views_controller.vocabulary_manage.list_vocabulary_controller import ListVocabularyController
|
| 61 |
|
| 62 |
from .api_controller.rating_sacales_controller import RatingScalesController
|
tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py
CHANGED
|
@@ -19,13 +19,6 @@ class CreateVocabularyController():
|
|
| 19 |
"form_word": WordForm(),
|
| 20 |
"words": []
|
| 21 |
}
|
| 22 |
-
|
| 23 |
-
if "name_voca" in request.GET:
|
| 24 |
-
current = Vocabulario.objects.get(
|
| 25 |
-
nombre_vocabulario=request.GET["name_voca"])
|
| 26 |
-
self.context["name_vacabulary"] = current.nombre_vocabulario
|
| 27 |
-
self.context["words"] = current.palabras.all()
|
| 28 |
-
|
| 29 |
return render(request, self.current_url, self.context)
|
| 30 |
|
| 31 |
def controllPost(self, request: HttpRequest):
|
|
@@ -39,70 +32,28 @@ class CreateVocabularyController():
|
|
| 39 |
return render(request, self.current_url, self.context)
|
| 40 |
|
| 41 |
new_vocabulary_name = request.POST.get("nombre_vocabulario").strip()
|
| 42 |
-
is_update = request.POST.get("is_update")
|
| 43 |
-
|
| 44 |
-
if is_update:
|
| 45 |
-
if "original_name" not in request.POST:
|
| 46 |
-
self.context["error"] = "Nombre original de vocabulario requerido"
|
| 47 |
-
return render(request, self.current_url, self.context)
|
| 48 |
-
|
| 49 |
-
original_name = request.POST["original_name"].strip()
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
| 55 |
|
|
|
|
|
|
|
| 56 |
try:
|
| 57 |
-
|
| 58 |
-
nombre_vocabulario=original_name)
|
| 59 |
-
except Vocabulario.DoesNotExist:
|
| 60 |
-
self.context["error"] = "No existe un vocabulario con ese nombre"
|
| 61 |
-
return render(request, self.current_url, self.context)
|
| 62 |
-
|
| 63 |
-
words_json = request.POST.get("words", "")
|
| 64 |
-
if words_json:
|
| 65 |
-
try:
|
| 66 |
-
words_list = json.loads(words_json)
|
| 67 |
-
|
| 68 |
-
ids = [int(w.get("id", 0))
|
| 69 |
-
for w in words_list if str(w.get("id", "")).isdigit()]
|
| 70 |
|
| 71 |
-
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
current_vocababulary.nombre_vocabulario = new_vocabulary_name
|
| 75 |
-
current_vocababulary.save()
|
| 76 |
-
except (json.JSONDecodeError, ValueError):
|
| 77 |
-
self.context["error"] = 'Ocurrió un error al revisar las palabras, revise “Ver vocabularios”, para reasignar las palabras'
|
| 78 |
-
return render(request, self.current_url, self.context)
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
try:
|
| 84 |
-
new_vocababulary = Vocabulario.objects.create(
|
| 85 |
-
nombre_vocabulario=new_vocabulary_name)
|
| 86 |
-
except IntegrityError:
|
| 87 |
-
self.context["error"] = "Ya existe un vocabulario con ese nombre"
|
| 88 |
return render(request, self.current_url, self.context)
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
try:
|
| 93 |
-
words_list = json.loads(words_json)
|
| 94 |
-
|
| 95 |
-
ids = [int(w.get("id", 0))
|
| 96 |
-
for w in words_list if str(w.get("id", "")).isdigit()]
|
| 97 |
-
|
| 98 |
-
words = Palabra.objects.filter(id__in=ids)
|
| 99 |
-
|
| 100 |
-
new_vocababulary.palabras.add(*words)
|
| 101 |
-
except (json.JSONDecodeError, ValueError):
|
| 102 |
-
self.context["error"] = 'Ocurrió un error al revisar las palabras, revise “Ver vocabularios”, para reasignar las palabras'
|
| 103 |
-
return render(request, self.current_url, self.context)
|
| 104 |
-
|
| 105 |
-
self.context["message"] = 'Vocabulario actualziado con éxito, puedes revisarlo en "Ver vocabularios"'
|
| 106 |
-
return render(request, self.current_url, self.context)
|
| 107 |
-
else:
|
| 108 |
-
pass
|
|
|
|
| 19 |
"form_word": WordForm(),
|
| 20 |
"words": []
|
| 21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
return render(request, self.current_url, self.context)
|
| 23 |
|
| 24 |
def controllPost(self, request: HttpRequest):
|
|
|
|
| 32 |
return render(request, self.current_url, self.context)
|
| 33 |
|
| 34 |
new_vocabulary_name = request.POST.get("nombre_vocabulario").strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
try:
|
| 37 |
+
new_vocababulary = Vocabulario.objects.create(
|
| 38 |
+
nombre_vocabulario=new_vocabulary_name)
|
| 39 |
+
except IntegrityError:
|
| 40 |
+
self.context["error"] = "Ya existe un vocabulario con ese nombre"
|
| 41 |
+
return render(request, self.current_url, self.context)
|
| 42 |
|
| 43 |
+
words_json = request.POST.get("words", "")
|
| 44 |
+
if words_json:
|
| 45 |
try:
|
| 46 |
+
words_list = json.loads(words_json)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
ids = [int(w.get("id", 0))
|
| 49 |
+
for w in words_list if str(w.get("id", "")).isdigit()]
|
| 50 |
|
| 51 |
+
words = Palabra.objects.filter(id__in=ids)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
new_vocababulary.palabras.add(*words)
|
| 54 |
+
except (json.JSONDecodeError, ValueError):
|
| 55 |
+
self.context["error"] = 'Ocurrió un error al revisar las palabras, revise “Ver vocabularios”, para reasignar las palabras'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
return render(request, self.current_url, self.context)
|
| 57 |
|
| 58 |
+
self.context["message"] = 'Vocabulario creado con éxito, puedes revisarlo en "Ver vocabularios"'
|
| 59 |
+
return render(request, self.current_url, self.context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/controllers/views_controller/vocabulary_manage/list_vocabulary_controller.py
CHANGED
|
@@ -40,7 +40,7 @@ class ListVocabularyController():
|
|
| 40 |
return controller_error("índice inválido")
|
| 41 |
|
| 42 |
if not vocabularies_in_page.object_list:
|
| 43 |
-
return controller_error("Sin registros de
|
| 44 |
|
| 45 |
current_page = vocabularies_in_page.number
|
| 46 |
is_last_page = not current_page < paginator.num_pages
|
|
|
|
| 40 |
return controller_error("índice inválido")
|
| 41 |
|
| 42 |
if not vocabularies_in_page.object_list:
|
| 43 |
+
return controller_error("Sin registros de Vocabularios")
|
| 44 |
|
| 45 |
current_page = vocabularies_in_page.number
|
| 46 |
is_last_page = not current_page < paginator.num_pages
|
tecnicas/controllers/views_controller/vocabulary_manage/view_vocabulary_controller.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
from django.http import HttpRequest
|
| 3 |
+
from tecnicas.models import Vocabulario
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class ViewVocabularyController():
|
| 7 |
+
context = {}
|
| 8 |
+
current_url = "tecnicas/manage_vocabulary/view-vocabulary.html"
|
| 9 |
+
|
| 10 |
+
def __init__(self):
|
| 11 |
+
self.context = {}
|
| 12 |
+
|
| 13 |
+
def controllGet(self, request: HttpRequest, nombre_vocabulario: str):
|
| 14 |
+
try:
|
| 15 |
+
vocabulary = Vocabulario.objects.get(
|
| 16 |
+
nombre_vocabulario=nombre_vocabulario)
|
| 17 |
+
|
| 18 |
+
self.context = {
|
| 19 |
+
"vocabulary": vocabulary,
|
| 20 |
+
"words": vocabulary.palabras.all().order_by('nombre_palabra')
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
except Vocabulario.DoesNotExist:
|
| 24 |
+
self.context = {
|
| 25 |
+
"error": f"No existe un vocabulario con el nombre '{nombre_vocabulario}'"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
return render(request, self.current_url, self.context)
|
tecnicas/static/img/words.webp
ADDED
|
tecnicas/static/js/created-vocabulary.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
// **************************************
|
| 2 |
// Create Vocabulary
|
| 3 |
// **************************************
|
| 4 |
-
async function submitSelectWords(classNanmeForm
|
| 5 |
const form = document.querySelector(`.${classNanmeForm}`);
|
| 6 |
|
| 7 |
const name_vocabulary = form.querySelector(".cts-name-voca").value;
|
|
@@ -20,29 +20,7 @@ async function submitSelectWords(classNanmeForm, update = false) {
|
|
| 20 |
wordsInput.name = "words";
|
| 21 |
wordsInput.value = JSON.stringify(listWordsSelect);
|
| 22 |
|
| 23 |
-
const [isUpdata, orinalName] = inputIsUpdateVocabulary(update);
|
| 24 |
-
|
| 25 |
form.appendChild(wordsInput);
|
| 26 |
-
form.appendChild(isUpdata);
|
| 27 |
-
if (orinalName) form.appendChild(orinalName);
|
| 28 |
|
| 29 |
form.submit();
|
| 30 |
}
|
| 31 |
-
|
| 32 |
-
function inputIsUpdateVocabulary(is_update = false) {
|
| 33 |
-
const isUpdata = document.createElement("input");
|
| 34 |
-
isUpdata.type = "hidden";
|
| 35 |
-
isUpdata.name = "is_update";
|
| 36 |
-
isUpdata.value = is_update;
|
| 37 |
-
|
| 38 |
-
if (is_update) {
|
| 39 |
-
const orinalName = document.querySelector(".cts-original-name").textContent;
|
| 40 |
-
const inputName = document.createElement("input");
|
| 41 |
-
inputName.type = "hidden";
|
| 42 |
-
inputName.name = "original_name";
|
| 43 |
-
inputName.value = orinalName;
|
| 44 |
-
return [isUpdata, inputName];
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
return [isUpdata, is_update];
|
| 48 |
-
}
|
|
|
|
| 1 |
// **************************************
|
| 2 |
// Create Vocabulary
|
| 3 |
// **************************************
|
| 4 |
+
async function submitSelectWords(classNanmeForm) {
|
| 5 |
const form = document.querySelector(`.${classNanmeForm}`);
|
| 6 |
|
| 7 |
const name_vocabulary = form.querySelector(".cts-name-voca").value;
|
|
|
|
| 20 |
wordsInput.name = "words";
|
| 21 |
wordsInput.value = JSON.stringify(listWordsSelect);
|
| 22 |
|
|
|
|
|
|
|
| 23 |
form.appendChild(wordsInput);
|
|
|
|
|
|
|
| 24 |
|
| 25 |
form.submit();
|
| 26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/templates/tecnicas/components/item_vocabulary.html
CHANGED
|
@@ -10,9 +10,9 @@
|
|
| 10 |
</div>
|
| 11 |
</div>
|
| 12 |
<div>
|
| 13 |
-
<a href="{% url 'cata_system:
|
| 14 |
<button class="btn bg-btn-primary border-0 block w-full btn-push">
|
| 15 |
-
|
| 16 |
</button>
|
| 17 |
</a>
|
| 18 |
</div>
|
|
|
|
| 10 |
</div>
|
| 11 |
</div>
|
| 12 |
<div>
|
| 13 |
+
<a href="{% url 'cata_system:ver_vocabulario' nombre_vocabulario=vocabulary.nombre_vocabulario %}">
|
| 14 |
<button class="btn bg-btn-primary border-0 block w-full btn-push">
|
| 15 |
+
Ver Detalles
|
| 16 |
</button>
|
| 17 |
</a>
|
| 18 |
</div>
|
tecnicas/templates/tecnicas/manage_vocabulary/create-vocabulary.html
CHANGED
|
@@ -26,15 +26,9 @@
|
|
| 26 |
<form action="" method="post" class="cts-craed-vocabulary bg-surface-card p-4 rounded-lg">
|
| 27 |
{% csrf_token %}
|
| 28 |
<label for="nombre_vocabulario" class="font-bold text-2xl mb-2 block">Nombre del vocabulario</label>
|
| 29 |
-
{% if name_vacabulary %}
|
| 30 |
-
<input id="nombre_vocabulario" name="nombre_vocabulario" type="text" required
|
| 31 |
-
class="cts-name-voca p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium"
|
| 32 |
-
placeholder="Ingrese un nombre" value="{{ name_vacabulary }}">
|
| 33 |
-
{% else %}
|
| 34 |
<input id="nombre_vocabulario" name="nombre_vocabulario" type="text" required
|
| 35 |
class="cts-name-voca p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium"
|
| 36 |
placeholder="Ingrese un nombre">
|
| 37 |
-
{% endif %}
|
| 38 |
<p class="text-lg mt-2 font-semibold">Debajo puede buscar y seleccionar palabras para asignarlas a
|
| 39 |
este vocabulario.</p>
|
| 40 |
</form>
|
|
@@ -105,22 +99,11 @@
|
|
| 105 |
</p>
|
| 106 |
</form>
|
| 107 |
|
| 108 |
-
{% if name_vacabulary %}
|
| 109 |
-
<p class="hidden cts-original-name">{{ name_vacabulary }}</p>
|
| 110 |
-
{% endif %}
|
| 111 |
-
|
| 112 |
<article class="flex justify-center gap-4 mt-4">
|
| 113 |
-
{% if name_vacabulary %}
|
| 114 |
-
<button type="button" name="start" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full"
|
| 115 |
-
onclick="submitSelectWords('cts-craed-vocabulary', true)">
|
| 116 |
-
Actualizar vocabulario
|
| 117 |
-
</button>
|
| 118 |
-
{% else %}
|
| 119 |
<button type="button" name="start" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full"
|
| 120 |
onclick="submitSelectWords('cts-craed-vocabulary')">
|
| 121 |
Crear vocabulario
|
| 122 |
</button>
|
| 123 |
-
{% endif %}
|
| 124 |
<a href="{% url 'cata_system:panel_vocabulario' %}" class="flex-1 w-full">
|
| 125 |
<button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
|
| 126 |
Cancelar
|
|
|
|
| 26 |
<form action="" method="post" class="cts-craed-vocabulary bg-surface-card p-4 rounded-lg">
|
| 27 |
{% csrf_token %}
|
| 28 |
<label for="nombre_vocabulario" class="font-bold text-2xl mb-2 block">Nombre del vocabulario</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
<input id="nombre_vocabulario" name="nombre_vocabulario" type="text" required
|
| 30 |
class="cts-name-voca p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium"
|
| 31 |
placeholder="Ingrese un nombre">
|
|
|
|
| 32 |
<p class="text-lg mt-2 font-semibold">Debajo puede buscar y seleccionar palabras para asignarlas a
|
| 33 |
este vocabulario.</p>
|
| 34 |
</form>
|
|
|
|
| 99 |
</p>
|
| 100 |
</form>
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
<article class="flex justify-center gap-4 mt-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
<button type="button" name="start" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full"
|
| 104 |
onclick="submitSelectWords('cts-craed-vocabulary')">
|
| 105 |
Crear vocabulario
|
| 106 |
</button>
|
|
|
|
| 107 |
<a href="{% url 'cata_system:panel_vocabulario' %}" class="flex-1 w-full">
|
| 108 |
<button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
|
| 109 |
Cancelar
|
tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
</header>
|
| 20 |
<section class="flex flex-col gap-7">
|
| 21 |
<div class="w-full h-40 rounded-lg max-sm:hidden">
|
| 22 |
-
<img src="{% static 'img/
|
| 23 |
class="w-full h-full object-cover rounded-xl">
|
| 24 |
</div>
|
| 25 |
<a href="{% url 'cata_system:crear_vocabulario' %}" class="flex-1">
|
|
@@ -33,7 +33,7 @@
|
|
| 33 |
</button>
|
| 34 |
</a>
|
| 35 |
<div class="w-full h-40 rounded-lg min-sm:hidden">
|
| 36 |
-
<img src="{% static 'img/
|
| 37 |
class="w-full h-full object-cover rounded-xl">
|
| 38 |
</div>
|
| 39 |
</section>
|
|
|
|
| 19 |
</header>
|
| 20 |
<section class="flex flex-col gap-7">
|
| 21 |
<div class="w-full h-40 rounded-lg max-sm:hidden">
|
| 22 |
+
<img src="{% static 'img/words.webp' %}" alt="varias personas en fila"
|
| 23 |
class="w-full h-full object-cover rounded-xl">
|
| 24 |
</div>
|
| 25 |
<a href="{% url 'cata_system:crear_vocabulario' %}" class="flex-1">
|
|
|
|
| 33 |
</button>
|
| 34 |
</a>
|
| 35 |
<div class="w-full h-40 rounded-lg min-sm:hidden">
|
| 36 |
+
<img src="{% static 'img/words.webp' %}" alt="varias personas en fila"
|
| 37 |
class="w-full h-full object-cover rounded-xl">
|
| 38 |
</div>
|
| 39 |
</section>
|
tecnicas/templates/tecnicas/manage_vocabulary/view-vocabulary.html
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Ver Vocabulario{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content">
|
| 9 |
+
<header class="text-center flex flex-row max-sm:flex-col gap-8 items-center w-full mb-6">
|
| 10 |
+
<div class="bg-surface-card p-4 text-black shadow-lg rounded-xl flex-1">
|
| 11 |
+
<h1 class="font-bold text-2xl">Detalles del Vocabulario</h1>
|
| 12 |
+
</div>
|
| 13 |
+
<div class="flex-1 flex justify-end items-center">
|
| 14 |
+
<a href="{% url 'cata_system:lista_vocabulario' num_page=1 %}" class="w-fit">
|
| 15 |
+
<button class="cts-btn-general cts-btn-secondary btn-push">
|
| 16 |
+
Volver a la Lista
|
| 17 |
+
</button>
|
| 18 |
+
</a>
|
| 19 |
+
</div>
|
| 20 |
+
</header>
|
| 21 |
+
|
| 22 |
+
{% if error %}
|
| 23 |
+
{% include "../components/error-message.html" with message=error %}
|
| 24 |
+
|
| 25 |
+
<div class="flex justify-center mt-6">
|
| 26 |
+
<a href="{% url 'cata_system:lista_vocabulario' num_page=1 %}">
|
| 27 |
+
<button class="cts-btn-general cts-btn-primary btn-push">
|
| 28 |
+
Ir a Lista de Vocabularios
|
| 29 |
+
</button>
|
| 30 |
+
</a>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
{% else %}
|
| 34 |
+
<section class="bg-surface-card p-6 rounded-lg shadow-lg space-y-6 text-black">
|
| 35 |
+
<!-- Información del Vocabulario -->
|
| 36 |
+
<div class="space-y-4">
|
| 37 |
+
<div class="bg-surface-alter-card p-4 rounded-lg">
|
| 38 |
+
<p class="font-bold text-xl mb-2">Nombre del Vocabulario:</p>
|
| 39 |
+
<p class="text-2xl font-semibold text-btn-primary">{{ vocabulary.nombre_vocabulario }}</p>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div class="bg-surface-alter-card p-4 rounded-lg">
|
| 43 |
+
<p class="font-bold text-lg mb-2">Fecha de Creación:</p>
|
| 44 |
+
<p class="text-lg">{{ vocabulary.creado|date:"d/m/Y H:i" }}</p>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<div class="bg-surface-alter-card p-4 rounded-lg">
|
| 48 |
+
<p class="font-bold text-lg mb-2">Total de Palabras:</p>
|
| 49 |
+
<p class="text-lg">{{ words|length }}</p>
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<!-- Lista de Palabras -->
|
| 54 |
+
<div class="mt-6">
|
| 55 |
+
<h2 class="font-bold text-2xl mb-4 text-center">Palabras del Vocabulario</h2>
|
| 56 |
+
<hr class="mb-4">
|
| 57 |
+
|
| 58 |
+
{% if words %}
|
| 59 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 60 |
+
{% for word in words %}
|
| 61 |
+
<div class="bg-gray-200 text-black rounded-lg font-medium text-lg px-4 py-3 text-center shadow">
|
| 62 |
+
{{ word.nombre_palabra }}
|
| 63 |
+
</div>
|
| 64 |
+
{% endfor %}
|
| 65 |
+
</div>
|
| 66 |
+
{% else %}
|
| 67 |
+
<div class="text-center py-8">
|
| 68 |
+
<p class="text-xl text-gray-500">Este vocabulario no tiene palabras asociadas</p>
|
| 69 |
+
</div>
|
| 70 |
+
{% endif %}
|
| 71 |
+
</div>
|
| 72 |
+
</section>
|
| 73 |
+
|
| 74 |
+
<!-- Botón adicional para volver -->
|
| 75 |
+
<div class="flex justify-center mt-6">
|
| 76 |
+
<a href="{% url 'cata_system:lista_vocabulario' num_page=1 %}" class="w-full max-w-md">
|
| 77 |
+
<button class="cts-btn-general cts-btn-error btn-push w-full">
|
| 78 |
+
Volver a la Lista
|
| 79 |
+
</button>
|
| 80 |
+
</a>
|
| 81 |
+
</div>
|
| 82 |
+
{% endif %}
|
| 83 |
+
</article>
|
| 84 |
+
</article>
|
| 85 |
+
{% endblock %}
|
tecnicas/urls.py
CHANGED
|
@@ -53,6 +53,10 @@ urlpatterns = [
|
|
| 53 |
views.createVocabulary,
|
| 54 |
name="crear_vocabulario"),
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
path("presenter/lista-vocabulario/<int:num_page>",
|
| 57 |
views.listVocabulary,
|
| 58 |
name="lista_vocabulario"),
|
|
|
|
| 53 |
views.createVocabulary,
|
| 54 |
name="crear_vocabulario"),
|
| 55 |
|
| 56 |
+
path("presenter/ver-vocabulario/<str:nombre_vocabulario>",
|
| 57 |
+
views.viewVocabulary,
|
| 58 |
+
name="ver_vocabulario"),
|
| 59 |
+
|
| 60 |
path("presenter/lista-vocabulario/<int:num_page>",
|
| 61 |
views.listVocabulary,
|
| 62 |
name="lista_vocabulario"),
|
tecnicas/views/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from .tester_management.tester_list import testerList
|
|
| 20 |
|
| 21 |
from .vocabulary_management.vocabulry_menu import vocabularyMenu
|
| 22 |
from .vocabulary_management.create_vocabulary import createVocabulary
|
|
|
|
| 23 |
from .vocabulary_management.list_vocabulary import listVocabulary
|
| 24 |
|
| 25 |
from .apis.api_tag import newTag
|
|
|
|
| 20 |
|
| 21 |
from .vocabulary_management.vocabulry_menu import vocabularyMenu
|
| 22 |
from .vocabulary_management.create_vocabulary import createVocabulary
|
| 23 |
+
from .vocabulary_management.view_vocabulary import viewVocabulary
|
| 24 |
from .vocabulary_management.list_vocabulary import listVocabulary
|
| 25 |
|
| 26 |
from .apis.api_tag import newTag
|
tecnicas/views/vocabulary_management/view_vocabulary.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
from django.http import HttpRequest
|
| 3 |
+
from tecnicas.controllers import ViewVocabularyController
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def viewVocabulary(req: HttpRequest, nombre_vocabulario: str):
|
| 7 |
+
view_controller = ViewVocabularyController()
|
| 8 |
+
if req.method == "GET":
|
| 9 |
+
response = view_controller.controllGet(req, nombre_vocabulario)
|
| 10 |
+
return response
|
| 11 |
+
else:
|
| 12 |
+
context = {"error": "Método no permitido"}
|
| 13 |
+
return render(req, "tecnicas/manage_vocabulary/view-vocabulary.html", context)
|