Skip to content

Commit 425ca5e

Browse files
committed
Rediseña los listados de /organization y /group: árbol de organismos y grid de temas
- /organization: árbol jerárquico propio (sin el wrapper de hierarchy), filas con nombre y cantidad de datasets; helper gobar_org_details_by_name para logo/count por nombre de organismo. - /group: grid compacto de tarjetas con imagen o placeholder y contador. - Estilos en gobar-base.css.
1 parent dfc2423 commit 425ca5e

5 files changed

Lines changed: 92 additions & 0 deletions

File tree

ckanext/gobar_theme/assets/css/gobar-base.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,15 @@ ul.hierarchy-tree li.highlighted > a {
247247
/* /group y /organization (índices): sin sidebar de ayuda, el primary pasa
248248
a ocupar todo el ancho en vez de dejar la columna vacía. */
249249
body.one-column .primary { width: 100%; max-width: 100%; float: none; }
250+
251+
/* ── Listados de /organization (árbol de organismos) y /group (temas) ── */
252+
.gobar-temas-grid { margin-top: 24px; }
253+
254+
.gobar-org-tree { list-style: none; padding: 0; margin: 24px 0 0; max-width: 780px; }
255+
.gobar-org-tree ul.hierarchy-tree { list-style: none; margin: 0 0 8px 24px; padding-left: 20px; border-left: 2px solid #DEE2E6; }
256+
.gobar-org-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; margin-bottom: 8px; background: var(--gobar-blanco); border: 1px solid #DEE2E6; border-radius: 4px; color: var(--gobar-navy) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
257+
.gobar-org-row:hover { border-color: var(--gobar-primary); box-shadow: 0 1px 3px rgba(33,45,81,.1); }
258+
.gobar-org-row-name { flex: 1; font-family: var(--font-cuerpo); font-size: 15px; font-weight: 600; line-height: 1.35; }
259+
.gobar-org-row-count { font-family: var(--font-cuerpo); font-size: 13px; color: var(--gobar-gris-oscuro); white-space: nowrap; }
260+
/* Resultado resaltado por la búsqueda del árbol (hierarchy) */
261+
.gobar-org-tree li.highlighted > .gobar-org-row { border-color: var(--gobar-primary); box-shadow: 0 1px 3px rgba(33,45,81,.15); }

ckanext/gobar_theme/helpers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ def gobar_organizations_with_details(limit: int = 20) -> list[dict[str, Any]]:
6262
return []
6363

6464

65+
def gobar_org_details_by_name() -> dict[str, dict[str, Any]]:
66+
"""Mapa nombre → org (logo, package_count) para el árbol de /organization.
67+
68+
ponytail: all_fields está capado por
69+
ckan.group_and_organization_list_all_fields_max (default 25); con más
70+
organismos que eso, los excedentes se muestran sin logo/count — subir ese
71+
valor en la config si hace falta.
72+
"""
73+
try:
74+
orgs = toolkit.get_action("organization_list")(
75+
{"ignore_auth": True}, {"all_fields": True}
76+
)
77+
return {o["name"]: o for o in orgs}
78+
except Exception:
79+
return {}
80+
81+
6582
# ── Custom pages helpers ──
6683

6784
def gobar_page_list() -> list[dict[str, str]]:
@@ -325,6 +342,7 @@ def get_helpers() -> dict[str, Any]:
325342
"gobar_group_count": gobar_group_count,
326343
"gobar_groups_with_details": gobar_groups_with_details,
327344
"gobar_organizations_with_details": gobar_organizations_with_details,
345+
"gobar_org_details_by_name": gobar_org_details_by_name,
328346
# Custom pages
329347
"gobar_page_list": gobar_page_list,
330348
"gobar_get_config": gobar_get_config,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{#
2+
Override del listado de /group: grilla de filas compactas (mismo patrón que
3+
las categorías de la home) en vez de la media-grid del core / árbol de
4+
groups_hierarchy. Los temas rara vez tienen jerarquía.
5+
6+
groups - lista de groups (page.items, con all_fields)
7+
#}
8+
{% block group_list %}
9+
<div class="gobar-cat-grid gobar-temas-grid">
10+
{% for group in groups %}
11+
<a href="{{ h.url_for((group.type or 'group') ~ '.read', id=group.name) }}"
12+
class="gobar-cat-card">
13+
{% if group.image_display_url %}
14+
<img src="{{ group.image_display_url }}" alt="" />
15+
{% else %}
16+
<div class="cat-icon-placeholder">
17+
<i class="fa fa-folder-open"></i>
18+
</div>
19+
{% endif %}
20+
<div class="gobar-cat-card-name">{{ group.display_name }}</div>
21+
<div class="gobar-cat-card-count">{{ group.package_count }}</div>
22+
</a>
23+
{% endfor %}
24+
</div>
25+
{% endblock %}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{#
2+
Override del listado de ckanext-hierarchy, sin el div #publisher-tree que
3+
solo agregaba un contenedor de más. Mantiene la lógica de highlight cuando
4+
hay búsqueda.
5+
#}
6+
{% if q is not defined %}{% set q = c.q %}{% endif %}
7+
{% if q %}
8+
{% set top_nodes = h.group_tree_highlight(organizations, h.group_tree(type_='organization')) %}
9+
{% else %}
10+
{% set top_nodes = h.group_tree(organizations=organizations, type_='organization') %}
11+
{% endif %}
12+
{% snippet 'organization/snippets/organization_tree.html', top_nodes=top_nodes %}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{#
2+
Override del árbol de ckanext-hierarchy: misma recursión y highlight de
3+
búsqueda, pero cada nodo como fila con logo y cantidad de datasets, y sin el
4+
asset viejo de hierarchy (los estilos viven en gobar-base.css).
5+
6+
top_nodes - nodos raíz de h.group_tree() (name/title/highlighted/children)
7+
#}
8+
{% set org_details = h.gobar_org_details_by_name() %}
9+
10+
<ul class="hierarchy-tree-top gobar-org-tree">
11+
{% for node in top_nodes recursive %}
12+
{% set org = org_details.get(node.name) %}
13+
<li id="node_{{ node.name }}"{% if node.highlighted %} class="highlighted"{% endif %}>
14+
<a href="{{ h.url_for('organization.read', id=node.name) }}" class="gobar-org-row">
15+
<span class="gobar-org-row-name">{{ node.title }}</span>
16+
{% if org %}
17+
<span class="gobar-org-row-count">{{ org.package_count }} datasets</span>
18+
{% endif %}
19+
</a>
20+
{% if node.children %}
21+
<ul class="hierarchy-tree">{{ loop(node.children) }}</ul>
22+
{% endif %}
23+
</li>
24+
{% endfor %}
25+
</ul>

0 commit comments

Comments
 (0)