Skip to content

Commit 4808abc

Browse files
committed
Corrige /group y /organization: saca el aside vacío y unifica Organismos/Temas
/group ya no mostraba el panel "¿Qué son los grupos?" pero seguía renderizando el <aside class="secondary"> vacío (una caja en blanco a la izquierda) porque solo se había vaciado secondary_content, no todo el bloque secondary. Mismo fix aplicado a un organization/index.html nuevo (no existía override: el título, breadcrumb, h1 y el panel de ayuda seguían siendo el default de CKAN core en español, "Organizaciones", sin importar ckanext.gobar_theme.organizations_label). Agrega body.one-column (solo en los índices /group y /organization, no en el detalle de un grupo/organización puntual, que sí tiene un sidebar de facetas real) para que el primary ocupe todo el ancho en vez de dejar la columna vacía. group_facets/organization_facets ahora pisan los labels de "organization"/ "groups" del sidebar de facetas con los mismos que usa dataset_facets (antes quedaban en el default de CKAN core, "Organizaciones"/"Grupos", inconsistente con el resto del sitio).
1 parent deff824 commit 4808abc

5 files changed

Lines changed: 38 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,7 @@ ul.hierarchy-tree li.highlighted > a {
243243
text-indent: -9999px;
244244
overflow: hidden;
245245
}
246+
247+
/* /group y /organization (índices): sin sidebar de ayuda, el primary pasa
248+
a ocupar todo el ancho en vez de dejar la columna vacía. */
249+
body.one-column .primary { width: 100%; max-width: 100%; float: none; }

ckanext/gobar_theme/plugin.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def dataset_facets(
158158
return facets_dict
159159
facets = OrderedDict()
160160
facets["organization"] = gobar_helpers.gobar_organizations_label()
161-
facets["groups"] = toolkit._("Grupos")
161+
facets["groups"] = "Temas"
162162
facets["res_format"] = toolkit._("Formato")
163163
facets["vocab_dataset_status"] = toolkit._("Estado")
164164
facets["vocab_dataset_accrualPeriodicity"] = toolkit._(
@@ -170,20 +170,34 @@ def dataset_facets(
170170

171171
# IFacets exige también estos dos: CKAN los invoca en las páginas de
172172
# grupo/organización y sin ellos esas vistas dan 500 (AttributeError).
173+
# Además de no romper, pisan los labels default de CKAN core
174+
# ("Organizations"/"Groups" traducidos) con los mismos que usa
175+
# dataset_facets, para que la faceta del sidebar diga lo mismo que el
176+
# resto del sitio (Organismos/Temas) en vez de quedar inconsistente.
173177
def group_facets(
174178
self,
175179
facets_dict: "OrderedDict[str, Any]",
176180
group_type: str,
177181
package_type: str | None,
178182
) -> "OrderedDict[str, Any]":
179-
return facets_dict
183+
return self._relabel_facets(facets_dict)
180184

181185
def organization_facets(
182186
self,
183187
facets_dict: "OrderedDict[str, Any]",
184188
organization_type: str,
185189
package_type: str | None,
186190
) -> "OrderedDict[str, Any]":
191+
return self._relabel_facets(facets_dict)
192+
193+
@staticmethod
194+
def _relabel_facets(
195+
facets_dict: "OrderedDict[str, Any]",
196+
) -> "OrderedDict[str, Any]":
197+
if "organization" in facets_dict:
198+
facets_dict["organization"] = gobar_helpers.gobar_organizations_label()
199+
if "groups" in facets_dict:
200+
facets_dict["groups"] = "Temas"
187201
return facets_dict
188202

189203
# ── IPackageController ──

ckanext/gobar_theme/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(gobar_color_overrides_style — vacío si no hay overrides configurados).
66
Un style inline le gana en especificidad a body.theme-profile-* sin
77
necesitar !important ni un <style>/:root aparte. #}
8-
{% block bodytag %}{{ super() }} class="theme-profile-{{ h.gobar_theme_profile() }}{% if request.path == '/' %} homepage{% endif %}{% if '/series' in request.path %} series-page{% endif %}"{% set color_style = h.gobar_color_overrides_style() %}{% if color_style %} style="{{ color_style }}"{% endif %}{% endblock %}
8+
{% block bodytag %}{{ super() }} class="theme-profile-{{ h.gobar_theme_profile() }}{% if request.path == '/' %} homepage{% endif %}{% if '/series' in request.path %} series-page{% endif %}{% if request.path in ('/group', '/group/', '/organization', '/organization/') %} one-column{% endif %}"{% set color_style = h.gobar_color_overrides_style() %}{% if color_style %} style="{{ color_style }}"{% endif %}{% endblock %}
99

1010
{% block styles %}
1111
{{ super() }}

ckanext/gobar_theme/templates/group/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ <h1 class="hide-heading">Temas</h1>
1313
{% endblock %}
1414
{% endblock %}
1515

16-
{% block secondary_content %}{% endblock %}
16+
{% block secondary %}{% endblock %}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% ckan_extends %}
2+
3+
{% block subtitle %}{{ h.gobar_organizations_label() }}{% endblock %}
4+
5+
{% block breadcrumb_content %}
6+
<li class="active">{% link_for h.gobar_organizations_label(), named_route=group_type+'.index' %}</li>
7+
{% endblock %}
8+
9+
{% block primary_content_inner %}
10+
<h1 class="hide-heading">{{ h.gobar_organizations_label() }}</h1>
11+
{% block organizations_search_form %}
12+
{% snippet 'snippets/search_form.html', form_id='organization-search-form', type=group_type, query=q, sorting_selected=sort_by_selected, count=page.item_count, placeholder='Buscar ' ~ h.gobar_organizations_label()|lower ~ '...', show_empty=request.args, no_bottom_border=true if page.items, sorting = [(_('Name Ascending'), 'title asc'), (_('Name Descending'), 'title desc')] %}
13+
{% endblock %}
14+
{% endblock %}
15+
16+
{% block secondary %}{% endblock %}

0 commit comments

Comments
 (0)