Skip to content

Commit 66e044e

Browse files
authored
Merge pull request #1 from datosgobar/features/landing-hints-y-sugerencias
Landing: hints de temas, chips de sugerencia que buscan de verdad, saca Más consultadas
2 parents 8f0f907 + de6c757 commit 66e044e

4 files changed

Lines changed: 29 additions & 3 deletions

File tree

ckanext/series_explorer/assets/css/series-explorer.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ body.series-page .gobar-topic-chip {
9595
}
9696
body.series-page .gobar-topic-chip:hover { background: rgba(57, 55, 147, .16); }
9797

98+
body.series-page .gobar-series-hints { text-align: center; margin: 8px 0 32px; }
99+
body.series-page .gobar-series-hints-label {
100+
color: var(--gobar-gris-oscuro); font-size: 0.85rem; margin: 0 0 4px;
101+
}
102+
98103
/* ── Barra superior (resultados / comparación enfocada) ── */
99104
body.series-page .gobar-series-topbar { margin-bottom: 24px; }
100105
body.series-page .gobar-series-search--compact input[type="search"] { border-width: 1.5px; }

ckanext/series_explorer/templates/series/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ <h1 class="gobar-series-hero-title">{{ _('Series de Tiempo') }}</h1>
6363
</div>
6464
{% endif %}
6565

66+
<section class="gobar-series-hints">
67+
<p class="gobar-series-hints-label">{{ _('Ideas para empezar:') }}</p>
68+
{{ topic_chip_list() }}
69+
</section>
70+
6671
{# ════════════════════ FOCUS COMPARE ═══════════════════════ #}
6772
{% elif mode == 'focus_compare' %}
6873
<section class="gobar-series-topbar">

ckanext/series_explorer/tests/test_views.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ def test_series_detail_404_cuando_api_responde_400(app, monkeypatch):
141141
assert resp.status_code == 404
142142

143143

144+
def test_series_topic_chips_limpia_busqueda_fallida(app):
145+
with app.flask_app.test_request_context("/series/?q=texto-sin-resultados"):
146+
chips = views._series_topic_chips()
147+
assert chips # SERIES_TOPIC_CHIPS no está vacío
148+
for chip in chips:
149+
assert "q=" not in chip["href"]
150+
151+
152+
def test_series_sort_options_sin_mas_consultadas():
153+
assert "hits_90_days" not in views.SERIES_SORT_OPTIONS
154+
155+
144156
def test_series_compare_parse_ambos_formatos(app):
145157
# ?compare=a,b y ?compare=a&compare=b deben parsear igual.
146158
for qs in ("/series/?compare=a,b", "/series/?compare=a&compare=b"):

ckanext/series_explorer/views.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
SERIES_API_URL = "https://apis.datos.gob.ar/series/api/search/"
2222
SERIES_PER_PAGE = 12
23-
SERIES_SORT_OPTIONS = ("relevance", "hits_90_days", "frequency")
23+
SERIES_SORT_OPTIONS = ("relevance", "frequency")
2424
SERIES_FACETS = (
2525
("dataset_theme", "Tema"),
2626
("dataset_source", "Fuente"),
@@ -195,7 +195,12 @@ def _series_meta_common(entry):
195195

196196
def _series_topic_chips():
197197
return [
198-
{"label": label, "href": _series_build_url({"dataset_theme": [label]})}
198+
{
199+
"label": label,
200+
# ponytail: limpia `q` para que el chip arranque una búsqueda
201+
# nueva por tema en vez de heredar un texto que ya dio 0 resultados.
202+
"href": _series_build_url({"dataset_theme": [label], "q": None}),
203+
}
199204
for label in SERIES_TOPIC_CHIPS
200205
]
201206

@@ -319,7 +324,6 @@ def series():
319324

320325
sort_labels = {
321326
"relevance": "Relevancia",
322-
"hits_90_days": "Más consultadas",
323327
"frequency": "Frecuencia",
324328
}
325329
sort_options = [

0 commit comments

Comments
 (0)